Class: ActiveFedora::Associations::Builder::HasAndBelongsToMany

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

Overview

:nodoc:

Constant Summary

Constants inherited from CollectionAssociation

CollectionAssociation::CALLBACKS

Instance Attribute Summary

Attributes inherited from Association

#mixin, #model, #name, #options

Instance Method Summary collapse

Methods inherited from CollectionAssociation

define_callback, define_callbacks

Methods inherited from Association

build, #configure_dependency, define_accessors, define_callbacks, define_readers, define_writers, #initialize, #predicate, #translate_property_to_predicate

Constructor Details

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

Instance Method Details

#buildObject



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

def build
  reflection = super
  define_destroy_hook
  reflection
end

#validate_optionsObject



7
8
9
10
11
12
13
14
# File 'lib/active_fedora/associations/builder/has_and_belongs_to_many.rb', line 7

def validate_options
  super
  if !options[:predicate]
    raise "You must specify a predicate for #{name}"
  elsif !options[:predicate].kind_of?(RDF::URI)
    raise ArgumentError, "Predicate must be a kind of RDF::URI"
  end
end