diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-01 10:36:47 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-06 03:34:15 +0900 |
commit | e3a295664681ea0480a9c95f6bfc776a113ff926 (patch) | |
tree | fa7bf2efd54dfda044a54d24e82cf352ec0e65a0 /activerecord/lib/active_record/relation/calculations.rb | |
parent | 03ac95a14058a871bff6b78d69c77436544635c6 (diff) | |
download | rails-e3a295664681ea0480a9c95f6bfc776a113ff926.tar.gz rails-e3a295664681ea0480a9c95f6bfc776a113ff926.tar.bz2 rails-e3a295664681ea0480a9c95f6bfc776a113ff926.zip |
Ensure `apply_join_dependency` for `collection_cache_key` if eager-loading is needed
Fixes #30315.
Diffstat (limited to 'activerecord/lib/active_record/relation/calculations.rb')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 116bddce85..11256ab3d9 100644 --- a/activerecord/lib/active_record/relation/calculations.rb +++ b/activerecord/lib/active_record/relation/calculations.rb @@ -130,7 +130,7 @@ module ActiveRecord # end def calculate(operation, column_name) if has_include?(column_name) - relation = apply_join_dependency(construct_join_dependency) + relation = apply_join_dependency relation.distinct! if operation.to_s.downcase == "count" relation.calculate(operation, column_name) @@ -180,7 +180,7 @@ module ActiveRecord end if has_include?(column_names.first) - relation = apply_join_dependency(construct_join_dependency) + relation = apply_join_dependency relation.pluck(*column_names) else relation = spawn |