1
0
Fork 0
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:
Rafael Mendonça França 2014-06-11 13:50:38 -03:00
commit f3b87be3bb

View file

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