aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/class_methods/join_dependency
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-12-31 20:00:24 +0000
committerJon Leighton <j@jonathanleighton.com>2010-12-31 20:00:45 +0000
commit12675988813e82ac30f7c0e0008c12c4cf5d8cdc (patch)
tree2856d3a21a139d0c182fc5a99724dc49e39d7eb5 /activerecord/lib/active_record/associations/class_methods/join_dependency
parent3c400627eb9cfac380d716ccf1182d61db4a45a6 (diff)
downloadrails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.tar.gz
rails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.tar.bz2
rails-12675988813e82ac30f7c0e0008c12c4cf5d8cdc.zip
Rename AssociationReflection#primary_key_name to foreign_key, since the options key which it relates to is :foreign_key
Diffstat (limited to 'activerecord/lib/active_record/associations/class_methods/join_dependency')
-rw-r--r--activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb8
1 files changed, 4 insertions, 4 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 02707dfae1..1e5149d80f 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
@@ -193,11 +193,11 @@ module ActiveRecord
first_key = second_key = nil
if through_reflection.macro == :belongs_to
- jt_primary_key = through_reflection.primary_key_name
+ jt_primary_key = through_reflection.foreign_key
jt_foreign_key = through_reflection.association_primary_key
else
jt_primary_key = through_reflection.active_record_primary_key
- jt_foreign_key = through_reflection.primary_key_name
+ jt_foreign_key = through_reflection.foreign_key
if through_reflection.options[:as] # has_many :through against a polymorphic join
jt_conditions <<
@@ -231,7 +231,7 @@ module ActiveRecord
join_table[reflection.source_reflection.options[:foreign_type]].
eq(reflection.options[:source_type])
else
- second_key = source_reflection.primary_key_name
+ second_key = source_reflection.foreign_key
end
end
@@ -262,7 +262,7 @@ module ActiveRecord
end
def join_belongs_to_to(relation)
- foreign_key = options[:foreign_key] || reflection.primary_key_name
+ foreign_key = options[:foreign_key] || reflection.foreign_key
primary_key = options[:primary_key] || reflection.klass.primary_key
join_target_table(