I posted earlier and this is an extenstion of my old question. I have a several users in my db and each will add their results. I need a way of taki开发者_运维问答ng each of these results and displaying them all (for all results from all users) into a table. I tried something like:
<% Result.find(:all) do |result| %>
<%= result.name %>
<% end %>
where name is a field in the model Result and that did not display anything. Any ideas into how to do that. Much appreciated.
Hey, you missed each
<% Result.find(:all).each do |result| %>
<%= result.name %>
<% end %>
or
<% Result.all.each do |result| %>
<%= result.name %>
<% end %>
Update
<table>
<tr>
<% Result.all.each do |result| %>
<td><%= result.name %></td>
<% end %>
</tr>
</table>
You have forget to call each
<% Result.all.each do |result| %>
<%= result.name %>
<% end %>
精彩评论