I have this code in my controller:
@cats = DirCat.all
And this in a view:
%ul#menu
= @cats.each do |item|
%li
= link_to item.title, "/catalog/#{item.id}/"
And get strange output:
<ul id='menu'>
<li>
<a href="/catalog/4/">hello</a>
</li>
<li>
<a href="/catalog/5/">hello 1</a>
</li>
#<DataMapper::Collection:0x85a9d00>
</ul>
In the irb console:
irb(main):002:0> c.each { |item| puts item.title }
hello
hello 1
=> [#<DirCat @id=4 @parent_id=1 @title="hello">, #<DirCat @id=5 @parent_id=1 @title="hello 1">]
How can I get out #<DataMapper::Collection:0x85a9d00>
from my html?