From 3c4186b366a14042a6ea6cc3432634d41986d1e2 Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Mon, 18 Jan 2010 22:05:43 +0530 Subject: Remove construct_calculation_arel_with_included_associations because it's same as construct_finder_arel_with_included_associations --- activerecord/lib/active_record/calculations.rb | 28 +------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'activerecord/lib/active_record/calculations.rb') diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index 051f22db85..f279bdfc8d 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -162,7 +162,7 @@ module ActiveRecord merge_with_joins = current_scoped_methods ? current_scoped_methods.joins_values : [] joins = (merge_with_joins + Array.wrap(options[:joins])).uniq join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, includes, construct_join(joins)) - construct_calculation_arel_with_included_associations(options, join_dependency) + construct_finder_arel_with_included_associations(options, join_dependency) else relation = unscoped.apply_finder_options(options.slice(:joins, :conditions, :order, :limit, :offset, :group, :having)) @@ -181,32 +181,6 @@ module ActiveRecord end end - def construct_calculation_arel_with_included_associations(options, join_dependency) - relation = unscoped - - for association in join_dependency.join_associations - relation = association.join_relation(relation) - end - - if current_scoped_methods - relation.joins_values = (current_scoped_methods.joins_values + relation.joins_values).uniq - relation.where_values = current_scoped_methods.where_values - - merge_limit = current_scoped_methods.taken - end - - relation = relation.apply_finder_options(options.slice(:joins, :group, :having, :order, :conditions, :from)). - select(column_aliases(join_dependency)) - - if !using_limitable_reflections?(join_dependency.reflections) && (merge_limit || options[:limit]) - relation = relation.where(construct_arel_limited_ids_condition(options, join_dependency)) - end - - relation = relation.limit(options[:limit] || merge_limit) if using_limitable_reflections?(join_dependency.reflections) - - relation - end - end end end -- cgit v1.2.3