Class: ActiveFedora::Associations::Builder::CollectionAssociation
- Inherits:
-
Association
- Object
- Association
- ActiveFedora::Associations::Builder::CollectionAssociation
- Defined in:
- lib/active_fedora/associations/builder/collection_association.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- CALLBACKS =
[:before_add, :after_add, :before_remove, :after_remove].freeze
Instance Attribute Summary
Attributes inherited from Association
#mixin, #model, #name, #options
Class Method Summary collapse
- .define_callback(model, callback_name, name, options) ⇒ Object
- .define_callbacks(model, reflection) ⇒ Object
Methods inherited from Association
build, #build, #configure_dependency, define_accessors, define_readers, define_writers, #initialize, #predicate, #translate_property_to_predicate, #validate_options
Constructor Details
This class inherits a constructor from ActiveFedora::Associations::Builder::Association
Class Method Details
.define_callback(model, callback_name, name, options) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/active_fedora/associations/builder/collection_association.rb', line 16 def self.define_callback(model, callback_name, name, ) full_callback_name = "#{callback_name}_for_#{name}" # TODO : why do i need method_defined? I think its because of the inheritance chain model.class_attribute full_callback_name.to_sym unless model.method_defined?(full_callback_name) model.send("#{full_callback_name}=", Array([callback_name.to_sym])) end |
.define_callbacks(model, reflection) ⇒ Object
10 11 12 13 14 |
# File 'lib/active_fedora/associations/builder/collection_association.rb', line 10 def self.define_callbacks(model, reflection) name = reflection.name = reflection. CALLBACKS.each { |callback_name| define_callback(model, callback_name, name, ) } end |