Skip to content
Browse files

Get rid of Base#merge_includes

  • Loading branch information...
1 parent e17b23d commit 7f8d4d3c4ed82a90f94251438d61d395a544026c @lifo lifo committed Jan 16, 2010
Showing with 2 additions and 6 deletions.
  1. +0 −5 activerecord/lib/active_record/base.rb
  2. +2 −1 activerecord/lib/active_record/calculations.rb
View
5 activerecord/lib/active_record/base.rb
@@ -1583,11 +1583,6 @@ def construct_join(joins)
end
end
- # Merges includes so that the result is a valid +include+
- def merge_includes(first, second)
- (Array.wrap(first) + Array.wrap(second)).uniq
- end
-
def build_association_joins(joins)
join_dependency = ActiveRecord::Associations::ClassMethods::JoinDependency.new(self, joins, nil)
relation = active_relation.table
View
3 activerecord/lib/active_record/calculations.rb
@@ -155,7 +155,8 @@ def construct_calculation_arel(options = {}, merge_with_relation = nil)
validate_calculation_options(options)
options = options.except(:distinct)
- includes = merge_includes(merge_with_relation ? merge_with_relation.includes_values : [], options[:include])
+ merge_with_includes = merge_with_relation ? merge_with_relation.includes_values : []
+ includes = (merge_with_includes + Array.wrap(options[:include])).uniq
if includes.any?
merge_with_joins = merge_with_relation ? merge_with_relation.joins_values : []

0 comments on commit 7f8d4d3

Please sign in to comment.
Something went wrong with that request. Please try again.