mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #25668 from kamipo/use_squish_rather_than_strip_heredoc
Use `squish` rather than `strip_heredoc`
This commit is contained in:
parent
2262bd0c67
commit
6c0fd9f3f2
2 changed files with 12 additions and 2 deletions
|
@ -479,7 +479,12 @@ module ActiveRecord
|
|||
# ball.touch(:updated_at) # => raises ActiveRecordError
|
||||
#
|
||||
def touch(*names, time: nil)
|
||||
raise ActiveRecordError, "cannot touch on a new record object" unless persisted?
|
||||
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
|
||||
|
||||
time ||= current_time_from_proper_timezone
|
||||
attributes = timestamp_attributes_for_update_in_model
|
||||
|
|
|
@ -8,7 +8,12 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def touch_later(*names) # :nodoc:
|
||||
raise ActiveRecordError, "cannot touch on a new record object" unless persisted?
|
||||
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
|
||||
|
||||
@_defer_touch_attrs ||= timestamp_attributes_for_update_in_model
|
||||
@_defer_touch_attrs |= names
|
||||
|
|
Loading…
Reference in a new issue