wrong number of arguments (1 for 0)

Hi,

I hope someone can help me because this is driving me crazy, I've spent hours trying to track this down. I'm trying to convert a Rails 1.1 to Rails 2.3.2 and I'm getting the following error when trying to save a many to many relationship. I've double checked all the associations, I've used console to test my models and they all work ok, I can do manually what I'm trying to do with Rails. There is something in the code somewhere outside of the model code that is causing this problem and I'm at a loss to track it down.

I've traced into the code for has_many_associations.rb:

        def insert_record(record, force = false, validate = true)           set_belongs_to_association_for(record)           force ? record.save! : record.save(validate)         end

and it blows up on the force ? record.save! : record.save(validate) line. Here is the stack trace:

wrong number of arguments (1 for 0)

RAILS_ROOT: /var/www/rails/dropzone Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/has_many_association.rb:61:in `save' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/has_many_association.rb:61:in `insert_record' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/association_proxy.rb:145:in `send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ associations/association_proxy.rb:145:in `send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ autosave_association.rb:291:in `save_collection_association' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ autosave_association.rb:284:in `each' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ autosave_association.rb:284:in `save_collection_association' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ autosave_association.rb:168:in `autosave_associated_records_for_booking_options' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:180:in `evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:180:in `evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:180:in `instance_eval' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:180:in `evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:166:in `call' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:93:in `run' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:92:in `each' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:92:in `send' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:92:in `run' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/ callbacks.rb:276:in `run_callbacks' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ callbacks.rb:344:in `callback' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ callbacks.rb:283:in `update' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:2868:in `create_or_update_without_callbacks' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ callbacks.rb:250:in `create_or_update' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ base.rb:2556:in `save_without_validation!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ validations.rb:1019:in `save_without_dirty!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ dirty.rb:87:in `save_without_transactions!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ transactions.rb:200:in `save__without_trace_ActiveRecord___self_class_name__save' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ connection_adapters/abstract/database_statements.rb:136:in `transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ transactions.rb:182:in `transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ transactions.rb:200:in `save__without_trace_ActiveRecord___self_class_name__save' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ transactions.rb:208:in `rollback_active_record_state!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ transactions.rb:200:in `save__without_trace_ActiveRecord___self_class_name__save' /var/www/rails/dropzone/vendor/plugins/newrelic_rpm/lib/new_relic/ agent/method_tracer.rb:138:in `save__without_trace_ActiveRecord_save' /var/www/rails/dropzone/vendor/plugins/newrelic_rpm/lib/new_relic/ agent/method_tracer.rb:41:in `trace_method_execution_with_scope' /var/www/rails/dropzone/vendor/plugins/newrelic_rpm/lib/new_relic/ agent/method_tracer.rb:137:in `save__without_trace_ActiveRecord_save' /var/www/rails/dropzone/vendor/plugins/newrelic_rpm/lib/new_relic/ agent/method_tracer.rb:141:in `save__without_trace_ActiveRecord_all' /var/www/rails/dropzone/vendor/plugins/newrelic_rpm/lib/new_relic/ agent/method_tracer.rb:141:in `save!' /var/www/rails/dropzone/app/controllers/bookings_controller.rb:137:in `update'

Any help appreciated, any suggestions on how to track down what is causing the problem would also be appreciated.

Thanks.

Hi,

I hope someone can help me because this is driving me crazy, I've spent hours trying to track this down. I'm trying to convert a Rails 1.1 to Rails 2.3.2 and I'm getting the following error when trying to save a many to many relationship. I've double checked all the associations, I've used console to test my models and they all work ok, I can do manually what I'm trying to do with Rails. There is something in the code somewhere outside of the model code that is causing this problem and I'm at a loss to track it down.

Have you (or a plugin) overwritten a core method somewhere ?

Fred