diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-01-16 23:59:57 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-01-16 23:59:57 +0530 |
commit | 7f8d4d3c4ed82a90f94251438d61d395a544026c (patch) | |
tree | 89dc5f5b2651b5c8160d6348cbf2a8a7db7fb05d /activerecord | |
parent | e17b23db016c03801ade2666793b4a51583f3785 (diff) | |
download | rails-7f8d4d3c4ed82a90f94251438d61d395a544026c.tar.gz rails-7f8d4d3c4ed82a90f94251438d61d395a544026c.tar.bz2 rails-7f8d4d3c4ed82a90f94251438d61d395a544026c.zip |
Get rid of Base#merge_includes
Diffstat (limited to 'activerecord')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 5 | ||||
-rw-r--r-- | activerecord/lib/active_record/calculations.rb | 3 |
2 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index acebf1e7fd..bf42a5b221 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1583,11 +1583,6 @@ module ActiveRecord #:nodoc: 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 diff --git a/activerecord/lib/active_record/calculations.rb b/activerecord/lib/active_record/calculations.rb index ed4218807d..f2de56ae5e 100644 --- a/activerecord/lib/active_record/calculations.rb +++ b/activerecord/lib/active_record/calculations.rb @@ -155,7 +155,8 @@ module ActiveRecord 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 : [] |