chewmanfoo wrote:
> http://weblog.rubyonrails.org/2006/3/1/new-in-rails-enumerable-group_by-and-array-in_groups_of
>
> enjoy!
Thank you for your quick response. Sadly, I can't get this array method
to do what I wish. See below:
> <% Category.all.in_groups_of(3, false) do |sorted_categories| %> |
> <% for category in sorted_categories %>
> <%= link_to category.name, :action => 'list', :category => category %>
> <% end %>
> <% end %>
The above is the code I'm using.
It currently sorts my categories as below:
> | Category1 Category2 Category3 | Category4 Category5 Category6 |
This is not what I want. What I want is:
> | Category1 | Category4 |
> | Category2 | Category5 |
> | Category3 | Category6 |
--
Posted via http://www.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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment