Class: ActiveFedora::Associations::ContainsAssociation

Inherits:
SingularAssociation show all
Defined in:
lib/active_fedora/associations/contains_association.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Association

#inversed, #owner, #reflection, #target

Instance Method Summary collapse

Methods inherited from SingularAssociation

#build, #create, #create!, #writer

Methods inherited from Association

#association_scope, #initialize, #initialize_attributes, #load_target, #loaded!, #loaded?, #reload, #reset, #scope, #set_inverse_instance, #stale_target?, #target_scope

Constructor Details

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

Instance Method Details

#find_targetObject


9
10
11
# File 'lib/active_fedora/associations/contains_association.rb', line 9

def find_target
  reflection.build_association(target_uri)
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/contains_association.rb', line 5

def reader(force_reload = false)
  super || build
end

#target_uriObject


13
14
15
# File 'lib/active_fedora/associations/contains_association.rb', line 13

def target_uri
  "#{owner.uri}/#{reflection.name}"
end