aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 16:23:53 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 16:23:53 +0100
commitb00db54e746ab0f1664d7f160b46beb49587b370 (patch)
treee2af5ae4b986e6013e317059ccb806e046244637 /activerecord/lib/active_record/associations.rb
parent915ea5ea826d48107e4c1953c7a32cf26727d10e (diff)
downloadrails-b00db54e746ab0f1664d7f160b46beb49587b370.tar.gz
rails-b00db54e746ab0f1664d7f160b46beb49587b370.tar.bz2
rails-b00db54e746ab0f1664d7f160b46beb49587b370.zip
Small refactoring
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rw-r--r--activerecord/lib/active_record/associations.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 9e000f2aae..028157d7e9 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -2186,9 +2186,7 @@ module ActiveRecord
# to represent the join table)
table, join_table = table
- # TODO: Can join_key just be reflection.primary_key_name ?
- join_key = reflection.options[:foreign_key] ||
- reflection.active_record.to_s.foreign_key
+ join_key = reflection.primary_key_name
join_foreign_key = reflection.active_record.primary_key
relation = relation.join(join_table, join_type).on(
@@ -2199,10 +2197,8 @@ module ActiveRecord
# We've done the first join now, so update the foreign_table for the second
foreign_table = join_table
- # TODO: Can foreign_key be reflection.association_foreign_key?
key = reflection.klass.primary_key
- foreign_key = reflection.options[:association_foreign_key] ||
- reflection.klass.to_s.foreign_key
+ foreign_key = reflection.association_foreign_key
end
else
case reflection.source_reflection.macro