Class: ActiveFedora::Reflection::ClassMethods::AssociationReflection

Inherits:
MacroReflection
  • Object
show all
Defined in:
lib/active_fedora/reflection.rb

Overview

Holds all the meta-data about an association as it was specified in the Active Record class.

Instance Attribute Summary

Attributes inherited from MacroReflection

#name, #options

Instance Method Summary collapse

Methods inherited from MacroReflection

#build_association, #class_name, #collection?, #klass

Constructor Details

#initialize(macro, name, options, active_record) ⇒ AssociationReflection

:nodoc:



120
121
122
123
# File 'lib/active_fedora/reflection.rb', line 120

def initialize(macro, name, options, active_record)
  super
  @collection = [:has_many, :has_and_belongs_to_many].include?(macro)
end

Instance Method Details

#primary_key_nameObject



125
126
127
# File 'lib/active_fedora/reflection.rb', line 125

def primary_key_name
  @primary_key_name ||= options[:foreign_key] || derive_primary_key_name
end