diff options
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 | 
