Hi, I''m new to RoR, so this may be a silly question. In this code <% for team in @teams %> <tr> <% for column in Team.content_columns %> <td><%=h team.send(column.name) %></td> <% end %> </tr> <% end %> I get back rows with each 2 columns. I only want the data of the first column, not the second. For one reason or the other (me) I cannot find the exact way to define the order/number/definition/id of a column. Something like column[0].name or so does not seem to work. (And I probably am thinking to un-RoR) Could someone please help me out on this one? Greatly appriciated. --~--~---------~--~----~------------~-------~--~----~ 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 Nov 13, 2006, at 4:42 PM, Rudy wrote:> Hi, I''m new to RoR, so this may be a silly question. > > In this code > > <% for team in @teams %> > <tr> > <% for column in Team.content_columns %> > <td><%=h team.send(column.name) %></td> > <% end %> > </tr> > <% end %> > > I get back rows with each 2 columns. I only want the data of the first > column, not the second. For one reason or the other (me) I cannot find > the exact way to define the order/number/definition/id of a column. > Something like column[0].name or so does not seem to work. (And I > probably am thinking to un-RoR) Could someone please help me out on > this one? Greatly appriciated.What this code is doing is displaying the content of each column for each team (that''s what the ''for column in Team.content_columns'' does) what you want is something like: <% for team in @teams %> <tr> <td><%=h team.name %></td> </tr> <% end %> James. -- James Stewart : Web Developer Work : http://jystewart.net Play : http://james.anthropiccollective.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Great. Exactly what I needed. Thanks for the response. I''m coming from years of programming in Realbasic, so this is something of a switch. But it is great fun. Keep up the good work, everyone. Thanks again. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---