Class: ActiveFedora::Associations::Builder::HasMany

Inherits:
CollectionAssociation show all
Defined in:
lib/active_fedora/associations/builder/has_many.rb

Overview

:nodoc:

Constant Summary

Constants inherited from CollectionAssociation

CollectionAssociation::CALLBACKS

Instance Attribute Summary

Attributes inherited from Association

#mixin, #model, #name, #options

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CollectionAssociation

define_callback, define_callbacks

Methods inherited from Association

build, define_accessors, define_callbacks, #initialize, #predicate, #translate_property_to_predicate, #validate_options

Constructor Details

This class inherits a constructor from ActiveFedora::Associations::Builder::Association

Class Method Details

.define_readers(mixin, name) ⇒ Object


13
14
15
16
17
18
19
# File 'lib/active_fedora/associations/builder/has_many.rb', line 13

def self.define_readers(mixin, name)
  super

  mixin.redefine_method("#{name.to_s.singularize}_ids") do
    association(name).ids_reader
  end
end

.define_writers(mixin, name) ⇒ Object


21
22
23
24
25
26
27
# File 'lib/active_fedora/associations/builder/has_many.rb', line 21

def self.define_writers(mixin, name)
  super

  mixin.redefine_method("#{name.to_s.singularize}_ids=") do |ids|
    association(name).ids_writer(ids)
  end
end

Instance Method Details

#buildObject


7
8
9
10
11
# File 'lib/active_fedora/associations/builder/has_many.rb', line 7

def build
  reflection = super
  configure_dependency
  reflection
end