Rails For Loop View
ruby-on-rails-3
Solution
The equals to signs you have are wrong. Try as below:
<tbody>
<% Item.each do |item|%>
<tr>
<th><%= item.rev %></th>
<th><%= item.name %></th>
</tr>
<% end %>
</tbody>
The <%= should only be used for expressions that need to be evaluated.
To help understand embedded ruby see this link http://www.ruby-doc.org/docs/ProgrammingRuby/html/web.html
Problem
I have the following code: ``` <tbody> <%= Item.each do |item|=%> <tr> <th><%= item.rev =%></th> <========= <th><%= item.name =%></th> </tr> <%= end =%> </tbody> ``` However I am getting a syntax error on the inidcated line. There is data in the database(Test case). No idea what I am doing wrong.