Class: ActiveRecord::Reflection::ThroughReflection

Inherits:
AbstractReflection show all
Defined in:
lib/composite_primary_keys/reflection.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from AbstractReflection

#join_scope

Instance Method Details

#association_primary_key(klass = nil) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/composite_primary_keys/reflection.rb', line 80

def association_primary_key(klass = nil)
  # Get the "actual" source reflection if the immediate source reflection has a
  # source reflection itself
  if primary_key = actual_source_reflection.options[:primary_key]
    # CPK
    # @association_primary_key ||= -primary_key.to_s
    @association_primary_key ||= primary_key.freeze
  else
    primary_key(klass || self.klass)
  end
end