开发者

Unable to Output Embedded Ruby code in Ruby on Rails Views

开发者 https://www.devze.com 2023-01-30 19:00 出处:网络
I\'m having a very small problem with my Rails App. I\'m setting up a Mac OS X for Ruby on Rails development and testing purposes.

I'm having a very small problem with my Rails App. I'm setting up a Mac OS X for Ruby on Rails development and testing purposes.

But for some reasons, my Views are not being rendered properly. I'm able to output all the HTML c开发者_运维百科ontent in my views, but when i use any Ruby/Rails code such as:

  <% 'Hello World' %> or 
  <%- 'Hello World!' %>

It is not being outputted at all... Please help.. I get no errors - nothing.

My environment is:

 Ruby: 1.9.2
 Rails 3.0.3
 OS: Mac OS X

Thanks.


<%= 'Hello World!' %>

its beacause without = your code is only processed. - is used e.g.

<%- if true %>
  <%= "Hello" %>

that will display only Hello


You need to use an = sign:

<%= 'Hello World!' %>
0

精彩评论

暂无评论...
验证码 换一张
取 消