aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 5d7c30caf9..1cdebd93d9 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1576,6 +1576,12 @@ module ActiveRecord #:nodoc:
self.attributes = attributes
save
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!
+ end
# Initializes the +attribute+ to zero if nil and adds one. Only makes sense for number-based attributes. Returns self.
def increment(attribute)