ActiveRecord::DangerousAttributeError ???

Hi,

For some reason, this harmless block of code in my application controller

  def index     @wide = true   end

is causing this hideous error. I have read the error means that the error is raised when attribute has a name reserved by ActiveRecord. Does that mean that none of my models can have columns named "toggle"?

Here is the error and framework trace:

ActiveRecord::DangerousAttributeError in ApplicationController#index toggle is defined by ActiveRecord

RAILS_ROOT: /usr/local/apache2/htdocs/dps2 Application Trace | Framework Trace | Full Trace

/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:88:in `instance_method_already_implemented?' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:64:in `define_attribute_methods' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:63:in `each' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:63:in `define_attribute_methods' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ attribute_methods.rb:290:in `respond_to?' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session/cookie_store.rb:133:in `dump' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session/cookie_store.rb:133:in `marshal' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session/cookie_store.rb:111:in `close' /usr/local/lib/ruby/1.8/cgi/session.rb:324:in `close' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1247:in `close_session' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1292:in `process_cleanup_without_flash' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/flash.rb:173:in `process_cleanup_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session_management.rb:133:in `process_cleanup_without_components' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/components.rb:161:in `process_cleanup' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:532:in `process_without_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:685:in `process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session_management.rb:123:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:388:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:171:in `handle_request' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:115:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:126:in `dispatch_cgi' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:9:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb: 112:in `handle_dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb: 78:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb: 62:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/ webrick.rb:66 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:496:in `require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:342:in `new_constants_in' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/ active_support/dependencies.rb:496:in `require' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb: 39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' script/server:3

Thanks, - Dave

is causing this hideous error. I have read the error means that the error is raised when attribute has a name reserved by ActiveRecord. Does that mean that none of my models can have columns named "toggle"?

This list is for discussions about improvements to rails' code, not for user support, you should get some responses on the talk list. But yes, that's what that error means.

Oops, sorry about that. But thanks. - Dave