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

Constants inherited from Association

Association::VALID_OPTIONS

Class Method Summary collapse

Methods inherited from CollectionAssociation

define_callback, define_callbacks, define_extensions, wrap_scope

Methods inherited from Association

add_destroy_callbacks, better_name, build, build_scope, check_dependent_options, create_reflection, define_accessors, define_callbacks, define_extensions, define_validations, validate_options, wrap_scope

Class Method Details

.define_readers(mixin, name) ⇒ Object



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

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



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

def self.define_writers(mixin, name)
  super

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

.macroObject



3
4
5
# File 'lib/active_fedora/associations/builder/has_many.rb', line 3

def self.macro
  :has_many
end

.valid_dependent_optionsObject



11
12
13
# File 'lib/active_fedora/associations/builder/has_many.rb', line 11

def self.valid_dependent_options
  [:destroy, :delete_all, :nullify, :restrict_with_error, :restrict_with_exception]
end

.valid_options(options) ⇒ Object



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

def self.valid_options(options)
  super + [:as, :dependent, :inverse_of]
end