aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/timestamp.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-11-04 13:14:06 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-11-04 13:14:07 -0200
commitd0d7555e8771414bdcf62ef0192ce8d8b6284219 (patch)
treeaa061aec64d2ffedc1234d2e198c13805e13a76d /activerecord/lib/active_record/timestamp.rb
parent92c6305954956cd845ebb89f4e1e44522e20a7c1 (diff)
downloadrails-d0d7555e8771414bdcf62ef0192ce8d8b6284219.tar.gz
rails-d0d7555e8771414bdcf62ef0192ce8d8b6284219.tar.bz2
rails-d0d7555e8771414bdcf62ef0192ce8d8b6284219.zip
Refactor logic to grab the max time of the list of timestamp names in #cache_key
Reuse the already existing logic used for grabbing this information from the updated columns.
Diffstat (limited to 'activerecord/lib/active_record/timestamp.rb')
-rw-r--r--activerecord/lib/active_record/timestamp.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index 9253150c4f..e0541b7681 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -98,8 +98,8 @@ module ActiveRecord
timestamp_attributes_for_create + timestamp_attributes_for_update
end
- def max_updated_column_timestamp
- if (timestamps = timestamp_attributes_for_update.map { |attr| self[attr] }.compact).present?
+ 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
end