diff options
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r-- | activerecord/lib/active_record/persistence.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb index e53cc5ee8c..3681a63e03 100644 --- a/activerecord/lib/active_record/persistence.rb +++ b/activerecord/lib/active_record/persistence.rb @@ -121,15 +121,19 @@ module ActiveRecord # Updates all the attributes from the passed-in Hash and saves the record. # If the object is invalid, the saving will fail and false will be returned. def update_attributes(attributes) - self.attributes = attributes - save + with_transaction_returning_status do + self.attributes = attributes + save + end end # Updates an object just like Base.update_attributes but calls save! instead # of save so an exception is raised if the record is invalid. def update_attributes!(attributes) - self.attributes = attributes - save! + with_transaction_returning_status do + self.attributes = attributes + save! + end end # Initializes +attribute+ to zero if +nil+ and adds the value passed as +by+ (default is 1). |