diff options
author | Andrew Horner <andrew@tablexi.com> | 2013-04-18 23:41:58 -0500 |
---|---|---|
committer | Andrew Horner <andrew@tablexi.com> | 2013-05-11 22:41:47 -0500 |
commit | c09829e03db611b46bb52e2054991222cf57bfbe (patch) | |
tree | 42c34f507693ff5e154272f830509a00b89a4462 /activerecord/lib/active_record/associations/join_dependency | |
parent | 5c6cf4e59e3e9c75395541162f2741b82347af0a (diff) | |
download | rails-c09829e03db611b46bb52e2054991222cf57bfbe.tar.gz rails-c09829e03db611b46bb52e2054991222cf57bfbe.tar.bz2 rails-c09829e03db611b46bb52e2054991222cf57bfbe.zip |
Preserve context for joins while merging relations
This is a backport of #10164, already merged into
master. The issue is described in lengthy detail
in issues #3002 and #5494.
Diffstat (limited to 'activerecord/lib/active_record/associations/join_dependency')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/join_dependency/join_association.rb index 03963ab060..becf1a3f62 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -55,7 +55,12 @@ module ActiveRecord def find_parent_in(other_join_dependency) other_join_dependency.join_parts.detect do |join_part| - parent == join_part + case parent + when JoinBase + parent.active_record == join_part.active_record + else + parent == join_part + end end end |