Try adding all of your virtual columns as non action-specific columns at the top of your controller
config.columns << :will_study_require_irb_approval You added it as an "update" column but not to the core columns, and then you are doing config.columns[:will_study_require_irb_approval].label = 'blah' ~Kenny On Wed, Feb 3, 2010 at 11:15 AM, Andrew Cates <[email protected]> wrote: > I've defined a virtual column and when I try to set it's label I get > "undefined method `label=' for nil:NilClass" > > Here is my model: > > class FundingApplication < ActiveRecord::Base > acts_as_paranoid > belongs_to :grant_category > belongs_to :application_type > > has_many :people, :order => :person_type_id > has_one :business_manager, :conditions => ["person_type_id = ?", > PersonType.business_manager], :class_name => 'Person' > has_one :optional_contact, :conditions => ["person_type_id = ?", > PersonType.optional_contact], :class_name => 'Person' > has_many :co_investigators, :conditions => ["person_type_id = ?", > PersonType.co_investigator], :class_name => 'Person' > has_one :principal_investigator, :conditions => ["person_type_id > = ?", PersonType.principal_investigator], :class_name => 'Person' > > mount_uploader :abstract, AttachmentUploader > mount_uploader :pre_proposal, AttachmentUploader > > > validates_presence_of :project_title, :amount_requested, > :grant_category_id, :application_type, :abstract, :pre_proposal > validates_numericality_of :amount_requested, :greater_than => > 0, :less_than_or_equal_to => 50000 > > validates_inclusion_of :will_study_require_irb_approval, > :will_study_require_iacuc_approval, :has_child_health_component_to_research, > :in > => [true, false] > > > validates_length_of :worked_with_co_investigator_explaination, :maximum > => 250, :tokenizer => lambda {|str| str.scan(/\w+/)}, :too_long => "is > too long (maximum is {{count}} words)" > > accepts_nested_attributes_for :people > > def self.yes_no > { > 1 => 'Yes', > 0 => 'No', > true => 'Yes', > false => 'No' > } > end > > def pi_first_name > principal_investigator.first_name > end > > def pi_last_name > principal_investigator.last_name > end > > end > > > and here is the AS controller: > > class Admin::PilotPreApplicationsController < ApplicationController > include ApplicationDownloader > > layout 'admin' > > active_scaffold :pilot_pre_application do |config| > config.label = "Pilot Pre Applications" > > config.create.link = false > config.update.multipart = true > #config.list.always_show_search = true > #config.actions.swap :search, :live_search > > config.action_links.add "Download", :controller => > 'pilot_pre_applications', :action => 'download', :type > => :record, :inline => false > > config.list.columns = > [ :pi_first_name, :project_title, :amount_requested, :grant_category, > :created_at ] > > config.show.columns = > [ :project_title, :grant_category, :amount_requested, > :will_study_require_irb_approval, :has_irb_approval, > :will_study_require_iacuc_approval, > :has_iacuc_approval, :worked_with_co_investigator_explaination, > :has_child_health_component_to_research, > :principal_investigator, :business_manager, > :optional_contact, :co_investigators, :abstract, :pre_proposal, > :created_at, :updated_at ] > > config.update.columns = > [ :project_title, :grant_category, :amount_requested, > :will_study_require_irb_approval, :has_irb_approval, > :will_study_require_iacuc_approval, > :has_iacuc_approval, :worked_with_co_investigator_explaination, > :has_child_health_component_to_research, > :abstract, :pre_proposal, :people, > :created_at, :updated_at ] > > > config.columns.each { |column| column.label = > column.label.titleize } > > config.columns[:people].show_blank_record = false > config.columns[:grant_category].clear_link > > config.columns[:will_study_require_irb_approval].label = "Requires > IRB Approval?" > config.columns[:will_study_require_iacuc_approval].label = > "Requires IACUC Approval?" > config.columns[:has_irb_approval].label = "Has IRB Approval?" > config.columns[:has_iacuc_approval].label = "Has IACUC Approval?" > config.columns[:has_child_health_component_to_research].label = > "Has Child Health Component?" > config.columns[:pi_first_name].label = "This" > > config.columns[:will_study_require_irb_approval].form_ui > = :checkbox > config.columns[:will_study_require_iacuc_approval].form_ui > = :checkbox > config.columns[:has_irb_approval].form_ui = :checkbox > config.columns[:has_iacuc_approval].form_ui = :checkbox > config.columns[:has_child_health_component_to_research].form_ui > = :checkbox > config.columns[:grant_category].form_ui = :select > config.columns[:created_at].form_ui = :calendar_date_select > config.columns[:updated_at].form_ui = :calendar_date_select > > config.columns[:created_at].label = "Submitted" > config.columns[:updated_at].label = "Updated" > end > > end > > > The error happens on line 39 of the controller > > Here is the error: > > undefined method `label=' for nil:NilClass > > Here is the full backtrace: > > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/whiny_nil.rb:52:in `method_missing' > /Users/amcates/Projects/pilot_project/app/controllers/admin/ > pilot_pre_applications_controller.rb:39 > /Users/amcates/Projects/pilot_project/vendor/plugins/active_scaffold/ > lib/active_scaffold/configurable.rb:11:in `instance_exec' > /Users/amcates/Projects/pilot_project/vendor/plugins/active_scaffold/ > lib/active_scaffold/configurable.rb:11:in `configure' > /Users/amcates/Projects/pilot_project/vendor/plugins/active_scaffold/ > lib/active_scaffold.rb:61:in `active_scaffold' > /Users/amcates/Projects/pilot_project/app/controllers/admin/ > pilot_pre_applications_controller.rb:6 > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:380:in > `load_without_new_constant_marking' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:380:in `load_file' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:521:in `new_constants_in' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:379:in `load_file' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:259:in `require_or_load' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:425:in `load_missing_constant' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/dependencies.rb:80:in `const_missing' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/inflector.rb:361:in `constantize' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/inflector.rb:360:in `each' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/inflector.rb:360:in `constantize' > /Users/amcates/Projects/pilot_project/vendor/rails/activesupport/lib/ > active_support/core_ext/string/inflections.rb:162:in `constantize' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/routing/route_set.rb:443:in `recognize' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/routing/route_set.rb:436:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/dispatcher.rb:87:in `dispatch' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/dispatcher.rb:121:in `_call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/dispatcher.rb:130:in `build_middleware_stack' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/query_cache.rb:29:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/query_cache.rb:29:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/connection_adapters/abstract/query_cache.rb:34:in > `cache' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/query_cache.rb:9:in `cache' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/query_cache.rb:28:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/activerecord/lib/ > active_record/connection_adapters/abstract/connection_pool.rb:361:in > `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/string_coercion.rb:25:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb: > 24:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/params_parser.rb:15:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/session/cookie_store.rb:93:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/failsafe.rb:26:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in > `synchronize' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/dispatcher.rb:114:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/reloader.rb:34:in `run' > /Users/amcates/Projects/pilot_project/vendor/rails/actionpack/lib/ > action_controller/dispatcher.rb:108:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/railties/lib/rails/ > rack/static.rb:31:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:46:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `each' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/urlmap.rb:40:in `call' > /Users/amcates/Projects/pilot_project/vendor/rails/railties/lib/rails/ > rack/log_tailer.rb:17:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/content_length.rb: > 13:in `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/chunked.rb:15:in > `call' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb: > 64:in `process' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' > /Library/Ruby/Gems/1.8/gems/rack-1.0.1/lib/rack/handler/mongrel.rb: > 34:in `run' > /Users/amcates/Projects/pilot_project/vendor/rails/railties/lib/ > commands/server.rb:111 > /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in > `gem_original_require' > /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' > script/server:3 > > > > Any help is greatly appreciated. > > > Andrew > > -- > 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]<activescaffold%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/activescaffold?hl=en. > > -- 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.
