search for: set_belongs_to_association_for

Displaying 3 results from an estimated 3 matches for "set_belongs_to_association_for".

2006 Jul 31
3
Polymorphic associations and single table inheritance
...has_many :addresses, :as => :addressable, :dependent => :destroy end class Member < Person end Adding an Address to a Member results in the addressable_type column equaling "Person" when it should be "Member". Looking in ActiveRecord::Associations::AssociationProxy#set_belongs_to_association_for and ActiveRecord::Associations:: HasManyAssociation#construct_sql it''s clear why. >From ActiveRecord::Associations::AssociationProxy#set_belongs_to_association_for: record["#{@reflection.options[:as]}_type"] = @owner.class.base_class.name.to_s Removing the call to base_c...
2009 Jun 04
1
wrong number of arguments (1 for 0)
...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...
2009 Sep 09
0
Rails 2.3.4 ActiveRecord association problem
...s_many :activity_reservations end class ActivityReservation < ActiveRecord::Base belongs_to :trip end trip.activity_reservations << ActivityReservation.new The has_many_associations code referenced: def insert_record(record, force = false, validate = true) set_belongs_to_association_for(record) force ? record.save! : record.save(validate) end The ActiveRecord save method: def save create_or_update end The comments for the save method indicate that it can take an optional perform_validations method, and the Validations module defines (with a...