aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/merger.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2012-05-05 21:36:24 +0100
committerJon Leighton <j@jonathanleighton.com>2012-05-05 21:36:24 +0100
commit06c787d2359660529ff5b927d3d34f22379eef00 (patch)
tree2fcc97230e0ec2be6bca91465d75b6a434f2b6da /activerecord/lib/active_record/relation/merger.rb
parentdcd04e76179611a9db28c9e391aa7d6c2a5b046a (diff)
downloadrails-06c787d2359660529ff5b927d3d34f22379eef00.tar.gz
rails-06c787d2359660529ff5b927d3d34f22379eef00.tar.bz2
rails-06c787d2359660529ff5b927d3d34f22379eef00.zip
Revert "Merge pull request #5494 from armstrjare/active_record_relation_keep_association_join_context_on_merge"
This reverts commit dcd04e76179611a9db28c9e391aa7d6c2a5b046a, reversing changes made to 58a49875df63729f07a9a81d1ee349087d258df5.
Diffstat (limited to 'activerecord/lib/active_record/relation/merger.rb')
-rw-r--r--activerecord/lib/active_record/relation/merger.rb31
1 files changed, 3 insertions, 28 deletions
diff --git a/activerecord/lib/active_record/relation/merger.rb b/activerecord/lib/active_record/relation/merger.rb
index c2f0a82fd3..3f880ce5e9 100644
--- a/activerecord/lib/active_record/relation/merger.rb
+++ b/activerecord/lib/active_record/relation/merger.rb
@@ -29,7 +29,7 @@ module ActiveRecord
end
class Merger
- attr_reader :relation, :other
+ attr_reader :relation, :values
def initialize(relation, other)
if other.default_scoped? && other.klass != relation.klass
@@ -37,17 +37,13 @@ module ActiveRecord
end
@relation = relation
- @other = other
- end
-
- def values
- @other.values
+ @values = other.values
end
def normal_values
Relation::SINGLE_VALUE_METHODS +
Relation::MULTI_VALUE_METHODS -
- [:where, :joins, :order, :bind, :reverse_order, :lock, :create_with, :reordering]
+ [:where, :order, :bind, :reverse_order, :lock, :create_with, :reordering]
end
def merge
@@ -58,7 +54,6 @@ module ActiveRecord
merge_multi_values
merge_single_values
- merge_joins
relation
end
@@ -89,26 +84,6 @@ module ActiveRecord
end
end
- def merge_joins
- return if values[:joins].blank?
-
- if other.klass == relation.klass
- relation.joins!(values[:joins])
- else
- joins_to_stash, other_joins = values[:joins].partition { |join|
- case join
- when Hash, Symbol, Array
- true
- else
- false
- end
- }
-
- join_dependency = ActiveRecord::Associations::JoinDependency.new(other.klass, joins_to_stash, [])
- relation.joins!(join_dependency.join_associations + other_joins)
- end
- end
-
def merged_binds
if values[:bind]
(relation.bind_values + values[:bind]).uniq(&:first)