Hello everyone, I''m new to ROR, and need some help. I''m trying to display information in columns. Here is what i got so far. <table> <% (@post = Post.find(:all)).to_a.in_groups_of(3) do |group| %> <tr> <% group.each do |title| %> <td><%= title %></td> <% end %> </tr> <% end %> </table> the title is a column value in db. I get in return the right table div''s, but no info only hashes. It looks like this when render: ### # So I know the columns are working, but how do I get it to display the data? -- 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 -~----------~----~----~----~------~----~------~--~---
I would guess group.each do |post| and then <%= post.title %> though in_groups_of is a new one on me. Vish On 10/25/06, Jorge Nolla <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hello everyone, > > I''m new to ROR, and need some help. I''m trying to display information in > columns. > Here is what i got so far. > > <table> > <% (@post = Post.find(:all)).to_a.in_groups_of(3) do |group| %> > <tr> > <% group.each do |title| %> > <td><%= title %></td> > <% end %> > </tr> > <% end %> > </table> > > the title is a column value in db. > > I get in return the right table div''s, but no info only hashes. It looks > like this when render: > > ### > # > > So I know the columns are working, but how do I get it to display the > data? > > > > > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
Thanks, I''ve tried that an this is the error I get: You have a nil object when you didn''t expect it! The error occured while evaluating nil.title Vishnu Gopal wrote:> I would guess group.each do |post| and then <%= post.title %> though > in_groups_of is a new one on me. > > Vish-- 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 -~----------~----~----~----~------~----~------~--~---