I searched around the forums for an answer to this question, but most seemed to deal with structures and functionality that are a little farther beyond what I am looking for. Given that a data set (say, @results), how would you display those results in a simple grid that is 5 items across and as many down as it needs to be. Thanks in advance for help with what seems to be an elusive but simple question. :) -- 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-/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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 6, 5:53 pm, Neil Hoyne <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I searched around the forums for an answer to this question, but most > seemed to deal with structures and functionality that are a little > farther beyond what I am looking for. > > Given that a data set (say, @results), how would you display those > results in a simple grid that is 5 items across and as many down as it > needs to be. > > Thanks in advance for help with what seems to be an elusive but simple > question. :)Without looking into the problem, I think I would draw 5 tables. Like so: split_count = @result.size / 5 split_counter = 0 @result.each do |result| <% split_counter++ %> # make a table and then begin a new table after split_counter has reached split_count. <% split_counter = 0 if split_counter == split_count %> end Beware when result.size is < 5 of course. just from the top of my head, there might very well be a better solution :) --~--~---------~--~----~------------~-------~--~----~ 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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Neil Hoyne wrote:> I searched around the forums for an answer to this question, but most > seemed to deal with structures and functionality that are a little > farther beyond what I am looking for. > > Given that a data set (say, @results), how would you display those > results in a simple grid that is 5 items across and as many down as it > needs to be. > > Thanks in advance for help with what seems to be an elusive but simple > question. :)Sounds like you want in_groups_of. See this thread for more info: http://www.ruby-forum.com/topic/73779#108452 -- 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-/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 http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---