I was trying to be clever, by taking some view code and stuff it into
controller code.
This is what I came up with to get an array of column names, but it
doesn''t work the way I expect it to. The view-source shows a bunch of
empty TD''s , so I know it''s looping through, but with no data.
Listing is a model/class
controller:
@column_names = Listing.content_columns.each {|x| x.human_name}
view:
<% @column_names.each do |t| %>
<td> <% t %> </td>
<%end%>
Any thoughts on making the column_names variable non blank?
Thanks
Matt
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
matt wrote:> > @column_names = Listing.content_columns.each {|x| x.human_name}Try... @column_names = Listing.content_columns.collect {|x| x.human_name} --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
matt wrote:> view: > <% @column_names.each do |t| %> > <td> <% t %> </td> > <%end%> >And also... <td> <%= t %> </td> --~--~---------~--~----~------------~-------~--~----~ 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 Tue, 2006-12-26 at 16:24 -0700, Jon Garvin wrote:> matt wrote: > > > > @column_names = Listing.content_columns.each {|x| x.human_name} > Try... > > @column_names = Listing.content_columns.collect {|x| x.human_name}That didn''t work either... I even restarted Webrick... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
hehe... I love being the idiot. Thanks for the eyes. Matt On Tue, 2006-12-26 at 16:27 -0700, Jon Garvin wrote:> matt wrote: > > view: > > <% @column_names.each do |t| %> > > <td> <% t %> </td> > > <%end%> > > > And also... > > <td> <%= t %> </td> > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---