diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-09 15:54:07 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-09 15:54:07 -0800 |
commit | 06ba9eaa62f756b70217f4d1e277c37e835343d4 (patch) | |
tree | 318245d8983892888075a9ca0d730670a8bc9c4c | |
parent | 12f67a70697212b55cde66f89ccd4caf0e9f4dad (diff) | |
download | rails-06ba9eaa62f756b70217f4d1e277c37e835343d4.tar.gz rails-06ba9eaa62f756b70217f4d1e277c37e835343d4.tar.bz2 rails-06ba9eaa62f756b70217f4d1e277c37e835343d4.zip |
move join creation a little closer to where it is used
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb index 5e37542416..b0091c613d 100644 --- a/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb +++ b/activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb @@ -116,8 +116,6 @@ module ActiveRecord end def join_target_table(relation, *conditions) - relation = relation.join(target_table, join_type) - # If the target table is an STI model then we must be sure to only include records of # its type and its sub-types. unless active_record.descends_from_active_record? @@ -135,7 +133,9 @@ module ActiveRecord conditions << process_conditions(options[:conditions], aliased_table_name) end - relation.on(*conditions) + join = relation.join(target_table, join_type) + + join.on(*conditions) end def join_has_and_belongs_to_many_to(relation) |