1
0
Fork 0
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:
Rafael França 2016-07-05 14:59:23 -03:00 committed by Rafael Mendonça França
parent 2262bd0c67
commit 6c0fd9f3f2
No known key found for this signature in database
GPG key ID: FC23B6D0F1EEE948
2 changed files with 12 additions and 2 deletions

View file

@ -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

View file

@ -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