Hi,
Try to organize the column list easily. Here is the 'ugly' code,
config.update.columns = [:company_id]
config.update.columns.add_subgroup "Name" do |group|
group.add :first_name, :last_name
end
config.update.columns << [:email]
config.update.columns.add_subgroup "Number" do |group|
group.add :office_phone, :office_ext, :cell_phone, :fax
group.collapsed = true
end
config.update.columns << [:type]
I am trying to make it simple, something like
config.update.columns = columns_init :company_id, ["Name", false,
:first_name, :last_name], :email, ["number", true, :office_phone,
:office_ext, :cell_phone, :fax], :type
This is the method,
def columns_init(*rest)
columns = ActiveScaffold::DataStructures::ActionColumns.new
for item in rest
if item.is_a? Symbol
columns << item
else
sub_columns = ActiveScaffold::DataStructures::ActionColumns.new
sub_columns.label = item[0]
sub_columns.action = columns.action
sub_columns.configure do |group|
group.add item[2..-1]
group.collapsed = item[1]
end
columns.add sub_columns
end
end
return columns
end
However I always get this error, no matter what column names I put there.
NoMethodError (undefined method `active_record_class' for nil:NilClass):
/vendor/plugins/active_scaffold/lib/active_scaffold/data_structures/action_columns.rb:58:in
`each'
/vendor/plugins/active_scaffold/lib/active_scaffold/config/form.rb:39:in
`to_a'
/vendor/plugins/active_scaffold/lib/active_scaffold/config/form.rb:39:in
`columns='
Any help is appreciated.
Thanks,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---