From 9639f65af534f7d9afeb359c30214fd6b4d71694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 10 Oct 2013 14:40:24 -0300 Subject: Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_target" This reverts commit 7ed5bdc834479c39e3b0ad5a38bcffe27983c10d, reversing changes made to 31c79e291f42b1d862df06c552fe002864aae705. Reason: this caused a regression when the associated record is creted in a before_create callback. See https://github.com/rails/rails/pull/12413#issuecomment-25848163 --- .../active_record/associations/collection_association.rb | 1 - .../test/cases/associations/inverse_associations_test.rb | 13 ------------- 2 files changed, 14 deletions(-) diff --git a/activerecord/lib/active_record/associations/collection_association.rb b/activerecord/lib/active_record/associations/collection_association.rb index baddb9852f..c2dd462b5d 100644 --- a/activerecord/lib/active_record/associations/collection_association.rb +++ b/activerecord/lib/active_record/associations/collection_association.rb @@ -350,7 +350,6 @@ module ActiveRecord end callback(:after_add, record) - set_inverse_instance(record) record end diff --git a/activerecord/test/cases/associations/inverse_associations_test.rb b/activerecord/test/cases/associations/inverse_associations_test.rb index a44b78f200..51e466ecac 100644 --- a/activerecord/test/cases/associations/inverse_associations_test.rb +++ b/activerecord/test/cases/associations/inverse_associations_test.rb @@ -290,19 +290,6 @@ class InverseHasManyTests < ActiveRecord::TestCase def test_trying_to_use_inverses_that_dont_exist_should_raise_an_error assert_raise(ActiveRecord::InverseOfAssociationNotFoundError) { Man.find(:first).secret_interests } end - - def test_child_instance_should_point_to_parent_without_saving - man = Man.new - i = Interest.create(:topic => 'Industrial Revolution Re-enactment') - - man.interests << i - assert_not_nil i.man - - i.man.name = "Charles" - assert_equal i.man.name, man.name - - assert !man.persisted? - end end class InverseBelongsToTests < ActiveRecord::TestCase -- cgit v1.2.3