This is roughly what I want (in midnight pseudo-code):
<% for column in Listing.content_columns[exclude: column_1, column_2] %>
<%= column.human_name %>
do-able?
Absolutely!
I’d say what’s missing is a content_columns_names method (at least I
can’t find one). It would look something like this:
class ActiveRecord::Base
def self.content_column_human_names
content_columns.map {|c| c.human_name }
end
end
You could put that into a plugin, or just roll it into your
application code (as below). In either case, it’s probably best to
put the array operation in the controller, which is a better place for
dynamic determination of names you don’t want.
So the whole thing might look like this (untested, and partially
pseudo-code):
<% @header_names.each do |name| %>
<%= name %>
<% end %>
David
–
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (Ruby for Rails)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.