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/lib | |
parent | 1606bee64ade812af1ef5b231e41b44bebddd67f (diff) | |
download | rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.tar.gz rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.tar.bz2 rails-2f0c8c52e66f1a2a3d1c00efc207f227124e96c2.zip |
remove deprecate #update_all usage
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/counter_cache.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/counter_cache.rb b/activerecord/lib/active_record/counter_cache.rb index f52979ebd9..b163ef3c12 100644 --- a/activerecord/lib/active_record/counter_cache.rb +++ b/activerecord/lib/active_record/counter_cache.rb @@ -69,7 +69,7 @@ module ActiveRecord "#{quoted_column} = COALESCE(#{quoted_column}, 0) #{operator} #{value.abs}" end - update_all(updates.join(', '), primary_key => id) + where(primary_key => id).update_all updates.join(', ') end # Increment a number field by one, usually representing a count. diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index bb504ae90f..12e232a97f 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -178,7 +178,7 @@ module ActiveRecord verify_readonly_attribute(name) raise ActiveRecordError, "can not update on a new record object" unless persisted? raw_write_attribute(name, value) - self.class.update_all({ name => value }, self.class.primary_key => id) == 1 + self.class.where(self.class.primary_key => id).update_all(name => value) == 1 end # Updates the attributes of the model from the passed-in hash and saves the @@ -313,7 +313,7 @@ module ActiveRecord @changed_attributes.except!(*changes.keys) primary_key = self.class.primary_key - self.class.unscoped.update_all(changes, { primary_key => self[primary_key] }) == 1 + self.class.unscoped.where(primary_key => self[primary_key]).update_all(changes) == 1 end end |