mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #15582 from sgrif/sg-timestamps
Refactor determination of max updated timestamp
This commit is contained in:
commit
f3b87be3bb
1 changed files with 5 additions and 3 deletions
|
@ -99,9 +99,11 @@ module ActiveRecord
|
|||
end
|
||||
|
||||
def max_updated_column_timestamp(timestamp_names = timestamp_attributes_for_update)
|
||||
if (timestamps = timestamp_names.map { |attr| self[attr] }.compact).present?
|
||||
timestamps.map { |ts| ts.to_time }.max
|
||||
end
|
||||
timestamp_names
|
||||
.map { |attr| self[attr] }
|
||||
.compact
|
||||
.map(&:to_time)
|
||||
.max
|
||||
end
|
||||
|
||||
def current_time_from_proper_timezone
|
||||
|
|
Loading…
Reference in a new issue