diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-11 20:48:21 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-05-11 20:48:21 -0700 |
commit | 5919a552e4e4203b8d5eb5234428bc00dd462c49 (patch) | |
tree | 42c34f507693ff5e154272f830509a00b89a4462 /activerecord/lib/active_record/associations | |
parent | 5c6cf4e59e3e9c75395541162f2741b82347af0a (diff) | |
parent | c09829e03db611b46bb52e2054991222cf57bfbe (diff) | |
download | rails-5919a552e4e4203b8d5eb5234428bc00dd462c49.tar.gz rails-5919a552e4e4203b8d5eb5234428bc00dd462c49.tar.bz2 rails-5919a552e4e4203b8d5eb5234428bc00dd462c49.zip |
Merge pull request #10303 from ahorner/3-2-stable
Preserve context for joins while merging relations
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 7 |
2 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index cd366ac8b7..e3d8356f49 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -109,7 +109,7 @@ module ActiveRecord case associations when Symbol, String reflection = parent.reflections[associations.to_s.intern] or - raise ConfigurationError, "Association named '#{ associations }' was not found; perhaps you misspelled it?" + raise ConfigurationError, "Association named '#{ associations }' was not found on #{parent.active_record.name}; perhaps you misspelled it?" unless join_association = find_join_association(reflection, parent) @reflections << reflection join_association = build_join_association(reflection, parent) 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 |