Class: ActiveRecord::Reflection::BelongsToReflection

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

Instance Method Summary collapse

Methods inherited from AssociationReflection

#active_record_primary_key, #association_foreign_key, #foreign_key

Instance Method Details

#association_primary_key(klass = nil) ⇒ Object



68
69
70
71
72
73
74
75
76
# File 'lib/composite_primary_keys/reflection.rb', line 68

def association_primary_key(klass = nil)
  if primary_key = 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