Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Merge pull request #12443 from arthurnn/add_inverse_of_add_ta…

…rget"

This reverts commit 7ed5bdc, reversing
changes made to 31c79e2.

Reason: this caused a regression when the associated record is creted in
a before_create callback.

See #12413 (comment)
  • Loading branch information...
commit fbc69ac5609aea9eab13fb01342272f812bce9d8 1 parent 5ede19b
@rafaelfranca rafaelfranca authored
View
1  activerecord/lib/active_record/associations/collection_association.rb
@@ -350,7 +350,6 @@ def add_to_target(record)
end
callback(:after_add, record)
- set_inverse_instance(record)
record
end
View
13 activerecord/test/cases/associations/inverse_associations_test.rb
@@ -290,19 +290,6 @@ def test_parent_instance_should_be_shared_with_first_n_and_last_n_children
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
Please sign in to comment.
Something went wrong with that request. Please try again.