I’m working in Ruby on Rails 2.3.8 and I’ve got a collection of categories. So, I would like to list them in three columns per row, in groups of 10, and to have as many rows as needed. The ammount of categories can change, so the functionality should be dynamic.
Is there a “rails way” to accomplish this? or which is the best way to do it?
Take a look at the following railscasts episode:
http://railscasts.com/episodes/28-in-groups-of
The “in_groups_of” method should be exactly what you require:
The documentation for in_groups_of can be found at:
http://railsbrain.com/api/rails-2.3.2/doc/index.html?a=M001423&name=in_groups_of