Reputation: 93
In localhost:3000/forum/new it shows my code instead of what it is supposed to be.
It shows this:
New Forum
link_to "Back", root_path
This is the code I have for this page:
<h1>New Forum</h1>
link_to "Back", root_path
It basically shows all my code. Any idea how to fix this problem?
Upvotes: 3
Views: 53
Reputation: 639
The .erb file process the embedded ruby in it to generate the corresponding html and syntax for it is <%= embedded ruby %>
. If you only want to process the ruby code but have nothing to print use <% embedded ruby %>
, note the eliminated =
sign.
Upvotes: 0
Reputation: 797
I think you are trying to do this:
<h1>New Forum</h1>
<%= link_to "Back", root_path %>
You forgot the <%=
and %>
for your code.
Upvotes: 5