aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/touch_later.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2019-04-29 18:49:12 +0900
committerRyuta Kamizono <kamipo@gmail.com>2019-04-29 18:49:12 +0900
commit302d739855306f9061f1f2357844cb8d76f20ae9 (patch)
treee219a57c33e4f72035d0f330c6ddc55ca7c05e9c /activerecord/lib/active_record/touch_later.rb
parente6c177e07cd4ea42df751b5baef8858efa97dfbd (diff)
downloadrails-302d739855306f9061f1f2357844cb8d76f20ae9.tar.gz
rails-302d739855306f9061f1f2357844cb8d76f20ae9.tar.bz2
rails-302d739855306f9061f1f2357844cb8d76f20ae9.zip
Extract `_raise_record_not_touched_error`
Diffstat (limited to 'activerecord/lib/active_record/touch_later.rb')
-rw-r--r--activerecord/lib/active_record/touch_later.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/touch_later.rb b/activerecord/lib/active_record/touch_later.rb
index 980e42664b..b60cc96165 100644
--- a/activerecord/lib/active_record/touch_later.rb
+++ b/activerecord/lib/active_record/touch_later.rb
@@ -10,12 +10,7 @@ module ActiveRecord
end
def touch_later(*names) # :nodoc:
- unless persisted?
- raise ActiveRecordError, <<-MSG.squish
- cannot touch on a new or destroyed record object. Consider using
- persisted?, new_record?, or destroyed? before touching
- MSG
- end
+ _raise_record_not_touched_error unless persisted?
@_defer_touch_attrs ||= timestamp_attributes_for_update_in_model
@_defer_touch_attrs |= names