https://github.com/emilysas/Chitter
I'm using DataMapper to make a mock of twitter.
I have a model called Peep (Tweet). And I want to be able to show all the tweets via an erb.
If I use
<%= Peep.first.content if Peep.first %>
Then I get the content I want, but obviously only for one item in my database.
If I try either:
<%= Peep.all.content if Peep.first %>
Or
<%= Peep.all.each {|peep| peep.content} %>
I get nothing.
Any help much appreciated!
This should work:
<% Peep.all.each do |peep| %>
<%= peep.content %>
<% end %>
To display content you shoud print each item, not the block.