diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-15 08:45:15 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-15 08:45:15 -0700 |
commit | cf232e37adc8cdf570a04415ba4c51a73dd06463 (patch) | |
tree | f75231993eb99848a389c0aad1d2a7c47e0d6f70 /activerecord/test/cases | |
parent | 0d0d46222cb87032e76bad42ef812b7ee7367873 (diff) | |
parent | f28096476dee5c7d5af037e4cdf06b339fe4778a (diff) | |
download | rails-cf232e37adc8cdf570a04415ba4c51a73dd06463.tar.gz rails-cf232e37adc8cdf570a04415ba4c51a73dd06463.tar.bz2 rails-cf232e37adc8cdf570a04415ba4c51a73dd06463.zip |
Merge pull request #7133 from roshats/fix_update_all_with_blank_argument
Change Relation#update_all with blank argument to raise an ArgumentError
instead of trying an update with empty fields.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 0bd48913e1..84027ea5ae 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1122,6 +1122,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal authors(:david), Author.order('id DESC , name DESC').last end + def test_update_all_with_blank_argument + assert_raises(ArgumentError) { Comment.update_all({}) } + end + def test_update_all_with_joins comments = Comment.joins(:post).where('posts.id' => posts(:welcome).id) count = comments.count |