diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-10 13:20:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-10 13:20:03 -0800 |
commit | 73d4d6704ec2a5b11e32d7f421f4614ac83d8384 (patch) | |
tree | 4d41882b25978674481f274a16e46c69b4c48808 | |
parent | 6e15a7fa3c42e183541a893196d83a83cfc20553 (diff) | |
download | rails-73d4d6704ec2a5b11e32d7f421f4614ac83d8384.tar.gz rails-73d4d6704ec2a5b11e32d7f421f4614ac83d8384.tar.bz2 rails-73d4d6704ec2a5b11e32d7f421f4614ac83d8384.zip |
avoid *args on join_target_table
-rw-r--r-- | activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb | 8 |
1 files changed, 5 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 b0091c613d..5c062e874e 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 @@ -115,7 +115,9 @@ module ActiveRecord active_record.send(:sanitize_sql, condition, table_name) end - def join_target_table(relation, *conditions) + def join_target_table(relation, condition) + conditions = [condition] + # 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? @@ -247,9 +249,9 @@ module ActiveRecord join_target_table( relation, target_table["#{reflection.options[:as]}_id"]. - eq(parent_table[parent.primary_key]), + eq(parent_table[parent.primary_key]).and( target_table["#{reflection.options[:as]}_type"]. - eq(parent.active_record.base_class.name) + eq(parent.active_record.base_class.name)) ) end |