Class: ActiveFedora::Associations::HasSubresourceAssociation
- Inherits:
-
SingularAssociation
- Object
- Association
- SingularAssociation
- ActiveFedora::Associations::HasSubresourceAssociation
- Defined in:
- lib/active_fedora/associations/has_subresource_association.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Association
#inversed, #owner, #reflection, #target
Instance Method Summary collapse
- #find_target ⇒ Object
-
#reader(force_reload = false) ⇒ Object
Implements the reader method, e.g.
- #target_uri ⇒ Object
Methods inherited from SingularAssociation
#build, #create, #create!, #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
Instance Method Details
#find_target ⇒ Object
9 10 11 12 13 |
# File 'lib/active_fedora/associations/has_subresource_association.rb', line 9 def find_target find_or_initialize_target do |record| configure_datastream(record) if reflection.[:block] end end |
#reader(force_reload = false) ⇒ Object
Implements the reader method, e.g. foo.bar for Foo.has_one :bar
5 6 7 |
# File 'lib/active_fedora/associations/has_subresource_association.rb', line 5 def reader(force_reload = false) super || build end |
#target_uri ⇒ Object
15 16 17 |
# File 'lib/active_fedora/associations/has_subresource_association.rb', line 15 def target_uri "#{owner.id}/#{reflection.name}" end |