From 302d739855306f9061f1f2357844cb8d76f20ae9 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Mon, 29 Apr 2019 18:49:12 +0900 Subject: Extract `_raise_record_not_touched_error` --- activerecord/lib/active_record/touch_later.rb | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'activerecord/lib/active_record/touch_later.rb') 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 -- cgit v1.2.3