diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-08-09 00:12:53 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-08-15 23:10:15 +0100 |
commit | 128d006242dae07edc65ad03e0e045adac0bbbf3 (patch) | |
tree | b06e9eb308ba00e12bae7fdaf8cd277ead5b352f /activerecord/test/cases | |
parent | 9482554f31f3ac7f941e6239890c60fcc01975e1 (diff) | |
download | rails-128d006242dae07edc65ad03e0e045adac0bbbf3.tar.gz rails-128d006242dae07edc65ad03e0e045adac0bbbf3.tar.bz2 rails-128d006242dae07edc65ad03e0e045adac0bbbf3.zip |
Support updates with joins. Fixes #522.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 821da91f0a..7bd9c44651 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -965,4 +965,12 @@ class RelationTest < ActiveRecord::TestCase def test_ordering_with_extra_spaces assert_equal authors(:david), Author.order('id DESC , name DESC').last end + + def test_update_all_with_joins + comments = Comment.joins(:post).where('posts.id' => posts(:welcome).id) + count = comments.count + + assert_equal count, comments.update_all(:post_id => posts(:thinking).id) + assert_equal posts(:thinking), comments(:greetings).post + end end |