Class: ActiveFedora::Associations::Builder::IndirectlyContains
- Inherits:
-
CollectionAssociation
- Object
- Association
- CollectionAssociation
- ActiveFedora::Associations::Builder::IndirectlyContains
- Defined in:
- lib/active_fedora/associations/builder/indirectly_contains.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from CollectionAssociation
Attributes inherited from Association
#inversed, #owner, #reflection, #target
Class Method Summary collapse
- .define_readers(mixin, name) ⇒ Object
- .macro ⇒ Object
- .valid_options(options) ⇒ Object
- .validate_options(options) ⇒ Object
Methods inherited from CollectionAssociation
#add_to_target, #any?, #build, #concat, #concat_records, #count, #create, #create!, #delete, #delete_all, #destroy, #destroy_all, #empty?, #find, #first, #ids_reader, #ids_writer, #include?, #last, #load_from_solr, #load_target, #null_scope?, #reader, #replace, #reset, #scope, #select, #size, #target=, #to_ary, #writer
Methods inherited from Association
#association_scope, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #reset, #reset_scope, #scope, #set_inverse_instance, #stale_target?, #target_scope
Constructor Details
This class inherits a constructor from ActiveFedora::Associations::Association
Class Method Details
.define_readers(mixin, name) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/active_fedora/associations/builder/indirectly_contains.rb', line 11 def self.define_readers(mixin, name) super mixin.redefine_method("#{name.to_s.singularize}_ids") do association(name).ids_reader end end |
.macro ⇒ Object
3 4 5 |
# File 'lib/active_fedora/associations/builder/indirectly_contains.rb', line 3 def self.macro :indirectly_contains end |
.valid_options(options) ⇒ Object
7 8 9 |
# File 'lib/active_fedora/associations/builder/indirectly_contains.rb', line 7 def self.() super + [:has_member_relation, :is_member_of_relation, :inserted_content_relation, :foreign_key, :through] - [:predicate] end |
.validate_options(options) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/active_fedora/associations/builder/indirectly_contains.rb', line 19 def self.() super raise ArgumentError, "You must specify a predicate for #{name}" if ![:has_member_relation] && ![:is_member_of_relation] raise ArgumentError, "Predicate must be a kind of RDF::URI" if ![:has_member_relation].is_a?(RDF::URI) && ![:is_member_of_relation].is_a?(RDF::URI) raise ArgumentError, "Missing :through option" unless [:through] raise ArgumentError, "Missing :foreign_key option" unless [:foreign_key] end |