diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-18 22:05:43 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-18 23:40:42 +0530 |
commit | 3c4186b366a14042a6ea6cc3432634d41986d1e2 (patch) | |
tree | cb028ebc1488578bf9d204b2fcf7173e1a6fd10f | |
parent | 893524382a54ac9f65c49f08759d47ca5049b381 (diff) | |
download | rails-3c4186b366a14042a6ea6cc3432634d41986d1e2.tar.gz rails-3c4186b366a14042a6ea6cc3432634d41986d1e2.tar.bz2 rails-3c4186b366a14042a6ea6cc3432634d41986d1e2.zip |
Remove construct_calculation_arel_with_included_associations because it's same as construct_finder_arel_with_included_associations
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 28 |
1 files changed, 1 insertions, 27 deletions
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 |