aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_one_association.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2010-10-19 12:47:19 +0100
committerJon Leighton <j@jonathanleighton.com>2010-10-19 12:47:19 +0100
commit596cc3b2329a9cc4a30c95c157ce36b2d08975df (patch)
tree2a67f6a9270bb528ad5df8bc805f2ef121e93858 /activerecord/lib/active_record/associations/has_one_association.rb
parent9ec07348749675110843c44f680da79223218db2 (diff)
downloadrails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.tar.gz
rails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.tar.bz2
rails-596cc3b2329a9cc4a30c95c157ce36b2d08975df.zip
Respect the :primary_key option on the through_reflection of (non-nested) through associations
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_one_association.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb
index 17901387e9..c6bcfec275 100644
--- a/activerecord/lib/active_record/associations/has_one_association.rb
+++ b/activerecord/lib/active_record/associations/has_one_association.rb
@@ -64,9 +64,9 @@ module ActiveRecord
end
protected
- def owner_quoted_id
- if @reflection.options[:primary_key]
- @owner.class.quote_value(@owner.send(@reflection.options[:primary_key]))
+ def owner_quoted_id(reflection = @reflection)
+ if reflection.options[:primary_key]
+ @owner.class.quote_value(@owner.send(reflection.options[:primary_key]))
else
@owner.quoted_id
end