diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-19 17:07:56 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-05-19 17:07:56 +0000 |
commit | 190e04645bf7ae873d922064783a71a88e0060fd (patch) | |
tree | dc2dcd1068dab32fc6a08e45e55673af13601043 /activerecord/test/associations_test.rb | |
parent | b3fcf2fa3c55584c6cb23d2195fbdc2647cc84cd (diff) | |
download | rails-190e04645bf7ae873d922064783a71a88e0060fd.tar.gz rails-190e04645bf7ae873d922064783a71a88e0060fd.tar.bz2 rails-190e04645bf7ae873d922064783a71a88e0060fd.zip |
Fixed that :delete_sql in has_and_belongs_to_many associations couldn't access record properties #1299 [Rick Olson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1313 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-x | activerecord/test/associations_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb index 3f0fa1c0b6..03fd2b263d 100755 --- a/activerecord/test/associations_test.rb +++ b/activerecord/test/associations_test.rb @@ -859,6 +859,25 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase assert_equal 0, david.projects(true).size end + def test_deleting_with_sql + david = Developer.find(1) + active_record = Project.find(1) + active_record.developers.reload + assert_equal 2, active_record.developers_by_sql.size + + active_record.developers_by_sql.delete(david) + assert_equal 1, active_record.developers_by_sql(true).size + end + + def test_deleting_array_with_sql + active_record = Project.find(1) + active_record.developers.reload + assert_equal 2, active_record.developers_by_sql.size + + active_record.developers_by_sql.delete(Developer.find_all) + assert_equal 0, active_record.developers_by_sql(true).size + end + def test_deleting_all david = Developer.find(1) david.projects.reload |