diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index ba40db2de9..36c757e155 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -173,7 +173,15 @@ module ActiveRecord JoinKeys = Struct.new(:key, :foreign_key) # :nodoc: def join_keys(association_klass) - JoinKeys.new(foreign_key, active_record_primary_key) + JoinKeys.new(join_pk(association_klass), join_fk) + end + + def join_pk(klass) + foreign_key + end + + def join_fk + active_record_primary_key end # Returns a list of scopes that should be applied for this Reflection @@ -711,9 +719,12 @@ module ActiveRecord end end - def join_keys(association_klass) - key = polymorphic? ? association_primary_key(association_klass) : association_primary_key - JoinKeys.new(key, foreign_key) + def join_fk + foreign_key + end + + def join_pk(klass) + polymorphic? ? association_primary_key(klass) : association_primary_key end def join_id_for(owner) # :nodoc: |