I am upgrading my app from Rails 2.2 to 2.3.5 and I am seeing the following error while using '<<' for saving a has_many relationship.
Eg: Breaks test
ev = UserEvent.new
# model specific code here
self.user_events << ev
Eg: Works
ev = UserEvent.new
# model specific code here
ev.user_id = self.id
ev.save!
This worked fine with Rails 2.2.
The issue that I see is similar to http://www.ruby-forum.com/topic/188598 (How can I track if a plugin or gem is causing this issue)
Full error log:
wrong number of arguments (1 for 0)
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:61:in `save'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/has_many_association.rb:61:in `insert_record'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:145:in `send'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:145:in `send'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/autosave_association.rb:298:in `save_collection_association'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:369:in `method_missing_without_paginate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `each'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `send'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:215:in `method_missing'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:369:in `method_missing_without_paginate'
/home/rails/.cruise/projects/rails235/work/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:167:in `method_missing'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/autosave_association.rb:289:in `save_collection_association'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/autosave_association.rb:168:in `autosave_associated_records_for_user_events'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:180:in `evaluate_method'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:180:in `evaluate_method'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:180:in `instance_eval'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:180:in `evaluate_method'
/home/rails/.cruise/projects/rails235/work/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:554:in `call'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activesupport/lib/active_support/callbacks.rb:276:in `run_callbacks'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/callbacks.rb:344:in `callback'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/callbacks.rb:267:in `create'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/base.rb:2874:in `create_or_update_without_callbacks'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/callbacks.rb:250:in `create_or_update'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/base.rb:2555:in `save_without_validation!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/validations.rb:1088:in `save_without_dirty!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/dirty.rb:87:in `save_without_transactions!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/transactions.rb:208:in `rollback_active_record_state!'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/transactions.rb:200:in `save!'
./db/migrate//294_add_system_user.rb:43:in `up_without_benchmarks'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `send'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/opt/ruby-enterprise/lib/ruby/1.8/benchmark.rb:293:in `measure'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:282:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `__send__'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:365:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:486:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `call'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:562:in `ddl_transaction'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:485:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `each'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:472:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:400:in `up'
/home/rails/.cruise/projects/rails235/work/vendor/rails/activerecord/lib/active_record/migration.rb:383:in `migrate'
/home/rails/.cruise/projects/rails235/work/vendor/rails/railties/lib/tasks/databases.rake:116
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `each'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:583:in `invoke'
/home/rails/.cruise/projects/rails235/work/lib/tasks/cruisecontrol.rake:23
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `each'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:583:in `invoke'
/opt/cruisecontrolrb-1.3.0/tasks/cc_build.rake:5:in `invoke_rake_task'
/opt/cruisecontrolrb-1.3.0/tasks/cc_build.rake:35
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `call'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:636:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `each'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:631:in `execute'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:597:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:590:in `invoke_with_call_chain'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:583:in `invoke'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2047:in `invoke_task'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2025:in `top_level'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2025:in `each'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2025:in `top_level'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2064:in `standard_exception_handling'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2019:in `top_level'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:1997:in `run'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:2064:in `standard_exception_handling'
/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/rake-0.8.6/lib/rake.rb:1994:in `run'
-e:1
Any help is tracking this down is really appreciated :)