diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-04-26 13:29:10 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-04-26 13:29:48 +0100 |
commit | 2f0c8c52e66f1a2a3d1c00efc207f227124e96c2 (patch) | |
tree | 820278eb4982fae64062a407e3972b7ff061fb9f /activerecord/test/cases | |
parent | 1606bee64ade812af1ef5b231e41b44bebddd67f (diff) | |
download | rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.tar.gz rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.tar.bz2 rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.zip |
remove deprecate #update_all usage
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 4 | ||||
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 8 |
2 files changed, 3 insertions, 9 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 54e0b40b4f..2650040a80 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -288,7 +288,7 @@ class DirtyTest < ActiveRecord::TestCase with_partial_updates Pirate, false do assert_queries(2) { 2.times { pirate.save! } } - Pirate.update_all({ :updated_on => old_updated_on }, :id => pirate.id) + Pirate.where(id: pirate.id).update_all(:updated_on => old_updated_on) end with_partial_updates Pirate, true do @@ -306,7 +306,7 @@ class DirtyTest < ActiveRecord::TestCase with_partial_updates Person, false do assert_queries(2) { 2.times { person.save! } } - Person.update_all({ :first_name => 'baz' }, :id => person.id) + Person.where(id: person.id).update_all(:first_name => 'baz') end with_partial_updates Person, true do diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index bb60aa0a66..15d14c7a8b 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -94,12 +94,6 @@ class PersistencesTest < ActiveRecord::TestCase assert_equal count, Pet.joins(:toys).where(where_args).delete_all end - def test_update_by_condition - Topic.update_all "content = 'bulk updated!'", ["approved = ?", true] - assert_equal "Have a nice day", Topic.find(1).content - assert_equal "bulk updated!", Topic.find(2).content - end - def test_increment_attribute assert_equal 50, accounts(:signals37).credit_limit accounts(:signals37).increment! :credit_limit @@ -338,7 +332,7 @@ class PersistencesTest < ActiveRecord::TestCase end def test_update_all_with_non_standard_table_name - assert_equal 1, WarehouseThing.update_all(['value = ?', 0], ['id = ?', 1]) + assert_equal 1, WarehouseThing.where(id: 1).update_all(['value = ?', 0]) assert_equal 0, WarehouseThing.find(1).value end |