diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-04 12:23:27 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-04 13:18:59 +0900 |
commit | 10919bfef2303c3409b15ed1d9405f3b4c518507 (patch) | |
tree | c3e270f76a71b6a58e751fdf8a14981bbe6d4dbc /activerecord/lib/active_record/integration.rb | |
parent | d49761cd66f55e18e0a7ee5138de0649c18654f0 (diff) | |
download | rails-10919bfef2303c3409b15ed1d9405f3b4c518507.tar.gz rails-10919bfef2303c3409b15ed1d9405f3b4c518507.tar.bz2 rails-10919bfef2303c3409b15ed1d9405f3b4c518507.zip |
Refactor `Relation#cache_key` is moved from `CollectionCacheKey#collection_cache_key`
The implementation of `Relation#cache_key` depends on some internal
relation methods (e.g. `apply_join_dependency`, `build_subquery`), but
somehow that implementation exists on the model class
(`collection_cache_key`), it sometimes bothers to me.
This refactors that implementation moves to `Relation#cache_key`, then
we can avoid `send` to call internal methods.
Diffstat (limited to 'activerecord/lib/active_record/integration.rb')
-rw-r--r-- | activerecord/lib/active_record/integration.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index 67a63cd2d1..b769541e95 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -152,6 +152,10 @@ module ActiveRecord end end end + + def collection_cache_key(collection = all, timestamp_column = :updated_at) # :nodoc: + collection.compute_cache_key(timestamp_column) + end end private |