I have a simple controller called list_controller with an index that basically does
def index
@lists = List.all
end
Then i have a view called index.html.haml that looks like:
%h1 My lists
= @lists.each do |list|
.row-fluid
%h2= list.title
%p= list.description
%hr
= link_to "New list", new_list_url
This works and renders but at the bottom of my list is what appears to be a ruby print of the lists objects, in this case a nice big ugly:
[#<List id: 1, title: "Petes todo list", description: "This is petes main list, all sorts of good stuff", created_at: "2012-03-26 21:42:57", updated_at: "2012-03-26 21:42:57">, #<List id: 2, title: "Petes work list", description: "A list for petes work stuff", created_at: "2012-03-26 22:09:50", updated_at: "2012-03-26 22:09:50">]
Why is this happening? How can I stop it?
You’re outputting the result of the
each, change:to:
Haml documentation:
=vs-