diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-11 13:50:38 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-11 13:50:38 -0300 |
commit | f3b87be3bb090a9fab006bf03dd37ee40b72735c (patch) | |
tree | acbea695c3050c911f35bc802542e9b231aabc3b | |
parent | e5203391040340a8c3b7959b7850c0e0a1eccb15 (diff) | |
parent | 82820ef53ddedaf0f5f20ba5ccd5466c1408c7de (diff) | |
download | rails-f3b87be3bb090a9fab006bf03dd37ee40b72735c.tar.gz rails-f3b87be3bb090a9fab006bf03dd37ee40b72735c.tar.bz2 rails-f3b87be3bb090a9fab006bf03dd37ee40b72735c.zip |
Merge pull request #15582 from sgrif/sg-timestamps
Refactor determination of max updated timestamp
-rw-r--r-- | activerecord/lib/active_record/timestamp.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb index 6c30ccab72..e2e37e7c00 100644 --- a/activerecord/lib/active_record/timestamp.rb +++ b/activerecord/lib/active_record/timestamp.rb @@ -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 |