Unable to Output Embedded Ruby code in Ruby on Rails Views
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!' %>
精彩评论