Hello,
I have a strange behavior in a view. If I do
<% @atoms.group_by(&:type).each do |type, atoms| %>
<p>
<h3><%= type %></h3>
<%= render :partial => ''row'', :collection =>
atoms %>
</p>
<% end %>
the problem is, first all types are listed and _below_ it all rows in
one block.
Why this happens?
If I do
<% @atoms.group_by(&:type).each do |type, atoms| %>
<p>
<h3><%= type %></h3>
<%= atoms.map {|atom| atom.name} %>
</p>
<% end %>
then it does what i expect: under every type it lists its own atoms.
How to achive this without a block in my view? Something like atoms.map
do |map| doesn''t work, I dont know why not.
Thanks for your advice.
--
Posted via ruby-forum.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---