rails/rails — Issue #3434: activerecord-2.3.14 breaks with ruby 1.9.2 in collection_accessor_methods() at line 1336 of lib/activerecord/associations.rb
Author: pydi
Created: 2011-10-25 17:26:18+00:00
State: open

undefined method `reject' for "4":String is thrown when I try to perform @user.update_attributes(params).

The params list is as follows

"user"=>{"login"=>"admin",
"first_name"=>"Admin",
"last_name"=>"Admin",
"email"=>"nfsurveytest+admin@neurofocus.com",
"location_id"=>"1",
"last_login_at_text"=>"Never logged in",
"password"=>"",
"password_confirmation"=>"",
"role_ids"=>"4",
"active"=>"true",
"is_staff"=>"true"},

The error stack is as below

/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/associations.rb:1336:in `block in collection_accessor_methods'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2918:in `block in assign_attributes'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2914:in `each'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2914:in `assign_attributes'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2787:in `attributes='
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2671:in `update_attributes_inside_transaction'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:229:in `block in with_transaction_returning_status'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:182:in `transaction'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/transactions.rb:228:in `with_transaction_returning_status'
/home/narendra/.rvm/gems/ruby-1.9.2-p290@nf_schedule/gems/activerecord-2.3.14/lib/active_record/base.rb:2667:in `update_attributes'
/home/narendra/workspace/nf_schedule/app/controllers/users_controller.rb:100:in `update'

I assume this breaks as String in ruby 1.9.2 does not mixin 'Enumerable'.

Can anyone confirm if this is an issue or I am missing something?