Module: CurationConcerns::ParentContainer

Extended by:
ActiveSupport::Concern
Defined in:
app/controllers/concerns/curation_concerns/parent_container.rb

Instance Method Summary collapse

Instance Method Details

#find_parent_by_idObject



13
14
15
# File 'app/controllers/concerns/curation_concerns/parent_container.rb', line 13

def find_parent_by_id
  ActiveFedora::Base.find(parent_id)
end

#lookup_parent_from_childObject



17
18
19
20
21
22
# File 'app/controllers/concerns/curation_concerns/parent_container.rb', line 17

def lookup_parent_from_child
  # in_objects method is inherited from Hydra::PCDM::ObjectBehavior
  return curation_concern.in_objects.first if curation_concern
  return CurationConcerns::ParentService.parent_for(@presenter.id) if @presenter
  raise "no child"
end

#parentObject

TODO: this is slow, refactor to return a Presenter (fetch from solr)



9
10
11
# File 'app/controllers/concerns/curation_concerns/parent_container.rb', line 9

def parent
  @parent ||= new_or_create? ? find_parent_by_id : lookup_parent_from_child
end

#parent_idObject



24
25
26
# File 'app/controllers/concerns/curation_concerns/parent_container.rb', line 24

def parent_id
  @parent_id ||= new_or_create? ? params[:parent_id] : lookup_parent_from_child.id
end