diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-09 10:30:03 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-10-09 10:50:31 +0900 |
commit | bb5b672ac6b4dd694a3f706d98d82f3000ce18cd (patch) | |
tree | 3c32c1c6e153816ff1ce4adc6592e7a315a77409 /activerecord | |
parent | fde880b09ac00accd1becbdeffa3340018d847cb (diff) | |
download | rails-bb5b672ac6b4dd694a3f706d98d82f3000ce18cd.tar.gz rails-bb5b672ac6b4dd694a3f706d98d82f3000ce18cd.tar.bz2 rails-bb5b672ac6b4dd694a3f706d98d82f3000ce18cd.zip |
Remove meaningless named `construct_relation_for_association_calculations`
I don't think this is a good abstraction because the internal method is
used only if the relation need to be applied join dependency.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/relation/calculations.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/relation/finder_methods.rb | 4 |
2 files changed, 3 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/relation/calculations.rb b/activerecord/lib/active_record/relation/calculations.rb index 0889d61c92..4ef0502893 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 = construct_relation_for_association_calculations + relation = apply_join_dependency(construct_join_dependency) relation.distinct! if operation.to_s.downcase == "count" relation.calculate(operation, column_name) @@ -180,7 +180,8 @@ module ActiveRecord end if has_include?(column_names.first) - construct_relation_for_association_calculations.pluck(*column_names) + relation = apply_join_dependency(construct_join_dependency) + relation.pluck(*column_names) else relation = spawn relation.select_values = column_names.map { |cn| diff --git a/activerecord/lib/active_record/relation/finder_methods.rb b/activerecord/lib/active_record/relation/finder_methods.rb index 6e07402979..707245bab2 100644 --- a/activerecord/lib/active_record/relation/finder_methods.rb +++ b/activerecord/lib/active_record/relation/finder_methods.rb @@ -394,10 +394,6 @@ module ActiveRecord ) end - def construct_relation_for_association_calculations - apply_join_dependency(construct_join_dependency) - end - def apply_join_dependency(join_dependency) relation = except(:includes, :eager_load, :preload).joins!(join_dependency) |