aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-10 14:40:24 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-10-10 14:55:07 -0300
commitfbc69ac5609aea9eab13fb01342272f812bce9d8 (patch)
tree7d5150a56b2c1f7aa114492bbf272cbe0ecb22c9 /activerecord
parent5ede19b7725b9f83a2231554b6d583117fbbb4c4 (diff)
downloadrails-fbc69ac5609aea9eab13fb01342272f812bce9d8.tar.gz
rails-fbc69ac5609aea9eab13fb01342272f812bce9d8.tar.bz2
rails-fbc69ac5609aea9eab13fb01342272f812bce9d8.zip
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
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/collection_association.rb1
-rw-r--r--activerecord/test/cases/associations/inverse_associations_test.rb13
2 files changed, 0 insertions, 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