Populating an array from a model with column names

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| %>

<% t %> <%end%>

Any thoughts on making the column_names variable non blank?

Thanks

Matt

matt wrote:

@column_names = Listing.content_columns.each {|x| x.human_name}
Try…

@column_names = Listing.content_columns.collect {|x| x.human_name}

matt wrote:

view:
<% @column_names.each do |t| %>

<% t %> <%end%>

And also…

<%= t %>

On Tue, 2006-12-26 at 16:24 -0700, Jon G. 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…

hehe… I love being the idiot.

Thanks for the eyes.

Matt