diff options
author | Jon Leighton <j@jonathanleighton.com> | 2010-12-15 23:27:15 +0000 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-15 17:50:14 -0800 |
commit | 14b880fd035fcdf807051398674c9aa89bd3b4d3 (patch) | |
tree | 6f80999405dea289391abfdf4552cea407d9cd45 /activerecord/lib/active_record/reflection.rb | |
parent | 09ddca67acbb88e2fdd7300670839cbf647b2694 (diff) | |
download | rails-14b880fd035fcdf807051398674c9aa89bd3b4d3.tar.gz rails-14b880fd035fcdf807051398674c9aa89bd3b4d3.tar.bz2 rails-14b880fd035fcdf807051398674c9aa89bd3b4d3.zip |
Fix various issues with the :primary_key option in :through associations [#2421 state:resolved]
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index fe4b518826..b9caa64a0e 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -205,7 +205,11 @@ module ActiveRecord end def association_foreign_key - @association_foreign_key ||= @options[:association_foreign_key] || class_name.foreign_key + @association_foreign_key ||= options[:association_foreign_key] || class_name.foreign_key + end + + def active_record_primary_key + @active_record_primary_key ||= options[:primary_key] || active_record.primary_key end def counter_cache_column |