diff options
author | Neeraj Singh <neerajdotname@gmail.com> | 2013-04-02 13:51:30 -0400 |
---|---|---|
committer | Neeraj Singh <neerajdotname@gmail.com> | 2013-04-02 15:00:06 -0400 |
commit | 6303cef42c91639642d38a58112b4921927e2ce1 (patch) | |
tree | de09088bdf8a5def4cc1921b5445c86bb6ab6964 | |
parent | 62affac0410a0762c78b5d9d2754661a9964e0cd (diff) | |
download | rails-6303cef42c91639642d38a58112b4921927e2ce1.tar.gz rails-6303cef42c91639642d38a58112b4921927e2ce1.tar.bz2 rails-6303cef42c91639642d38a58112b4921927e2ce1.zip |
not a relation. it's an arel select manager
-rw-r--r-- | activerecord/lib/active_record/associations/join_dependency/join_association.rb | 8 |
1 files changed, 4 insertions, 4 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 0d3b4dbab1..a332034cb0 100644 --- a/activerecord/lib/active_record/associations/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/join_dependency/join_association.rb @@ -59,7 +59,7 @@ module ActiveRecord end end - def join_to(relation) + def join_to(manager) tables = @tables.dup foreign_table = parent_table foreign_klass = parent.active_record @@ -75,7 +75,7 @@ module ActiveRecord foreign_key = reflection.foreign_key when :has_and_belongs_to_many # Join the join table first... - relation.from(join( + manager.from(join( table, table[reflection.foreign_key]. eq(foreign_table[reflection.active_record_primary_key]) @@ -109,13 +109,13 @@ module ActiveRecord constraint = constraint.and(item.arel.constraints) unless item.arel.constraints.empty? end - relation.from(join(table, constraint)) + manager.from(join(table, constraint)) # The current table in this iteration becomes the foreign table in the next foreign_table, foreign_klass = table, reflection.klass end - relation + manager end def build_constraint(reflection, table, key, foreign_table, foreign_key) |