diff options
author | Ben VandenBos <ben@avvo.com> | 2009-01-05 20:32:34 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-01-16 17:23:19 +0000 |
commit | 0e92f67073079fe3d34acd141099cdad28b0ee00 (patch) | |
tree | ec28c425d0c5bca7a9730c8804f30a8714541fb2 /activerecord/test/cases/associations/has_many_associations_test.rb | |
parent | f2ee3f20dfa9853b8bc4a3e13e59f25c26ae33ad (diff) | |
download | rails-0e92f67073079fe3d34acd141099cdad28b0ee00.tar.gz rails-0e92f67073079fe3d34acd141099cdad28b0ee00.tar.bz2 rails-0e92f67073079fe3d34acd141099cdad28b0ee00.zip |
Make belongs_to :dependent => :destroy destroy self before associated object [#1079 state:resolved]
If foreign key constraints are in place then deleteing the associated object first will cause a foreign key violation
Signed-off-by: Frederick Cheung <frederick.cheung@gmail.com>
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index a5ae5cd8ec..428fb50013 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -698,7 +698,8 @@ class HasManyAssociationsTest < ActiveRecord::TestCase authors(:david).destroy end - assert_equal [author_address.id], AuthorAddress.destroyed_author_address_ids[authors(:david).id] + assert_equal nil, AuthorAddress.find_by_id(authors(:david).author_address_id) + assert_equal nil, AuthorAddress.find_by_id(authors(:david).author_address_extra_id) end def test_invalid_belongs_to_dependent_option_raises_exception |