Upgraded our app from Rails 2.2.2 to 2.3.4, and I'm now encountering
an error when adding a child to a parent.
Top of the stack:
wrong number of arguments (1 for 0)
My code (in snippets):
class Trip < ActiveRecord::Base
class ActivityReservation < ActiveRecord::Base
trip.activity_reservations << ActivityReservation.new
The has_many_associations code referenced:
def insert_record(record, force = false, validate = true)
force ? record.save! : record.save(validate)
The ActiveRecord save method:
The comments for the save method indicate that it can take an optional
perform_validations method, and the Validations module defines (with
alias_method_chain :save, :validation).
So, finally my question: what is going on here? ActiveRecord is
calling a save method passing an arg, but the save method in
ActiveRecord isn't defined to take a boolean. I'm guessing that
something with the Validations and alias_method_chain is supposed to
handle this, but in the way I'm doing things in my code, its not
(ActiveRecord 2.2.2, which we were on previously, just called
ActiveRecord.save - not attempting to pass a boolean)
Any help or pointers would be greatly appreciated.