Class: ActiveFedora::Associations::Builder::DirectlyContainsOne
- Inherits:
-
SingularAssociation
- Object
- Association
- SingularAssociation
- ActiveFedora::Associations::Builder::DirectlyContainsOne
- Defined in:
- lib/active_fedora/associations/builder/directly_contains_one.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Association
#mixin, #model, #name, #options
Instance Method Summary collapse
Methods inherited from SingularAssociation
constructable?, define_accessors, define_constructors
Methods inherited from Association
build, #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
#validate_options ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/active_fedora/associations/builder/directly_contains_one.rb', line 7 def raise ArgumentError, "you must specify a :through option on #{name}. #{name} will use the container from that directly_contains association." if ![:through] if [:through] ([:through]) end super if [:class_name] == "ActiveFedora::File" raise ArgumentError, "You cannot set :class_name of #{name} to ActiveFedora::File because directly_contains_one needs to assert and read RDF.type assertions, which is not supported by ActiveFedora::File. To make Files support RDF.type assertions, define a subclass of ActiveFedora::File and make it `include ActiveFedora::WithMetadata`. Otherwise, all subclasses of ActiveFedora::Base support RDF.type assertions." elsif ![:has_member_relation] && ![:is_member_of_relation] raise ArgumentError, "You must specify a :has_member_relation or :is_member_of_relation predicate for #{name}" elsif ![:has_member_relation].kind_of?(RDF::URI) && ![:is_member_of_relation].kind_of?(RDF::URI) raise ArgumentError, "Predicate must be a kind of RDF::URI" end if ![:type].kind_of?(RDF::URI) raise ArgumentError, "You must specify a Type and it must be a kind of RDF::URI" end end |