diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-08 11:31:05 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-10-08 11:31:05 -0700 |
commit | ebe4f80512f5c13accf1885759ac2a38723b1c3d (patch) | |
tree | f76a3105cf87e19ef403f0c3e71c004fffcf4430 /activerecord/lib/active_record | |
parent | 84499eb4bd2e5fe686199c122194b72040411d04 (diff) | |
download | rails-ebe4f80512f5c13accf1885759ac2a38723b1c3d.tar.gz rails-ebe4f80512f5c13accf1885759ac2a38723b1c3d.tar.bz2 rails-ebe4f80512f5c13accf1885759ac2a38723b1c3d.zip |
hide join_parts internals from other classes
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency.rb | 23 | ||||
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 11 |
2 files changed, 17 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/associations/join_dependency.rb b/activerecord/lib/active_record/associations/join_dependency.rb index 89812a3826..4c4a0a95ac 100644 --- a/activerecord/lib/active_record/associations/join_dependency.rb +++ b/activerecord/lib/active_record/associations/join_dependency.rb @@ -41,7 +41,7 @@ module ActiveRecord def graft(*associations) associations.each do |association| join_associations.detect {|a| association == a} || - build(association.reflection.name, association.find_parent_in(self) || join_base, association.join_type) + build(association.reflection.name, find_parent_part(association.parent) || join_base, association.join_type) end self end @@ -50,10 +50,6 @@ module ActiveRecord join_parts.drop 1 end - def join_base - join_parts.first - end - def join_relation(relation) join_associations.inject(relation) do |rel,association| association.join_relation(rel) @@ -86,7 +82,22 @@ module ActiveRecord records end - protected + private + + def find_parent_part(parent) + join_parts.detect do |join_part| + case parent + when JoinBase + parent.base_klass == join_part.base_klass + else + parent == join_part + end + end + end + + def join_base + join_parts.first + end def remove_duplicate_results!(base, records, associations) case associations 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 ef8f5f1eb2..f6a04ef9f1 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -44,17 +44,6 @@ module ActiveRecord other.parent == parent end - def find_parent_in(other_join_dependency) - other_join_dependency.join_parts.detect do |join_part| - case parent - when JoinBase - parent.base_klass == join_part.base_klass - else - parent == join_part - end - end - end - def join_constraints joins = [] tables = @tables.dup |