This project is archived and is in readonly mode.

Changeset [5c7fd8766586dba42fba6fc738a733175dd9d46b] by Aaron Patterson

January 1st, 2011 @ 07:43 PM

Merge remote branch 'jonleighton/association_fixes' into fuuu

  • jonleighton/association_fixes: Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key Support for :counter_cache on polymorphic belongs_to Refactor BelongsToAssociation to allow BelongsToPolymorphicAssociation to inherit from it Specify the STI type condition using SQL IN rather than a whole load of ORs. Required a fix to ActiveRecord::Relation#merge for properly merging create_with_value. This also fixes a situation where the type condition was appearing twice in the resultant SQL query. Verify that when has_many associated objects are destroyed via :dependent => :destroy, when the parent is destroyed, the callbacks are run Get rid of extra_conditions param from configure_dependency_for_has_many. I can't see a particularly plausible argument for this being used by plugins, and if they really want they can just redefine the callback or whatever. Note also that before my recent commit the extra_conditions param was completely ignored for :dependent => :destroy. And owner_quoted_id can go too Now we can drop-kick AssociationReflection#dependent_conditions into oblivion. Refactor configure_dependency_for_has_many to use AssociationCollection#delete_all. It was necessary to change test_before_destroy in lifecycle_test.rb so that it checks topic.replies.size before doing the destroy, as afterwards it will now (correctly) be 0. https://github.com/rails/rails/commit/5c7fd8766586dba42fba6fc738a73...

Committed by Aaron Patterson

  • M activerecord/lib/active_record/association_preload.rb
  • M activerecord/lib/active_record/associations.rb
  • M activerecord/lib/active_record/associations/association_collection.rb
  • M activerecord/lib/active_record/associations/association_proxy.rb
  • M activerecord/lib/active_record/associations/belongs_to_association.rb
  • M activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb
  • M activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
  • M activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  • M activerecord/lib/active_record/associations/has_association.rb
  • M activerecord/lib/active_record/associations/has_many_association.rb
  • M activerecord/lib/active_record/associations/has_many_through_association.rb
  • M activerecord/lib/active_record/associations/has_one_association.rb
  • M activerecord/lib/active_record/associations/through_association.rb
  • M activerecord/lib/active_record/autosave_association.rb
  • M activerecord/lib/active_record/base.rb
  • M activerecord/lib/active_record/fixtures.rb
  • M activerecord/lib/active_record/reflection.rb
  • M activerecord/lib/active_record/relation/calculations.rb
  • M activerecord/lib/active_record/relation/spawn_methods.rb
  • M activerecord/test/cases/associations/belongs_to_associations_test.rb
  • M activerecord/test/cases/associations/callbacks_test.rb
  • M activerecord/test/cases/lifecycle_test.rb
  • M activerecord/test/cases/reflection_test.rb
  • M activerecord/test/cases/relation_scoping_test.rb
  • M activerecord/test/models/company.rb
  • M activerecord/test/schema/schema.rb

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>