aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/persistence.rb
diff options
context:
space:
mode:
authorDan Olson <olson_dan@yahoo.com>2014-12-27 17:17:57 -0600
committerDan Olson <olson_dan@yahoo.com>2014-12-27 22:22:37 -0600
commite780e2fda326fa5ea616e1441a6ed81b2890085c (patch)
treefa3db96769d699bc7bdb4623d727c7302b0d6159 /activerecord/lib/active_record/persistence.rb
parent307ec3db0fe26cbd1811d34a27e6637726ce23ce (diff)
downloadrails-e780e2fda326fa5ea616e1441a6ed81b2890085c.tar.gz
rails-e780e2fda326fa5ea616e1441a6ed81b2890085c.tar.bz2
rails-e780e2fda326fa5ea616e1441a6ed81b2890085c.zip
Provide :touch option to save() to accommodate saving without updating timestamps. [#18202]
Diffstat (limited to 'activerecord/lib/active_record/persistence.rb')
-rw-r--r--activerecord/lib/active_record/persistence.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index bb1d01d089..ded190c111 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -116,8 +116,8 @@ module ActiveRecord
#
# Attributes marked as readonly are silently ignored if the record is
# being updated.
- def save(*)
- create_or_update
+ def save(*args)
+ create_or_update(*args)
rescue ActiveRecord::RecordInvalid
false
end
@@ -138,8 +138,8 @@ module ActiveRecord
#
# Attributes marked as readonly are silently ignored if the record is
# being updated.
- def save!(*)
- create_or_update || raise(RecordNotSaved.new(nil, self))
+ def save!(*args)
+ create_or_update(*args) || raise(RecordNotSaved.new(nil, self))
end
# Deletes the record in the database and freezes this instance to
@@ -498,9 +498,9 @@ module ActiveRecord
relation
end
- def create_or_update
+ def create_or_update(*args)
raise ReadOnlyRecord, "#{self.class} is marked as readonly" if readonly?
- result = new_record? ? _create_record : _update_record
+ result = new_record? ? _create_record : _update_record(*args)
result != false
end