Module: Hyrax::ParentContainer

Extended by:
ActiveSupport::Concern
Included in:
FileSetsController
Defined in:
app/controllers/concerns/hyrax/parent_container.rb

Instance Method Summary collapse

Instance Method Details

#find_parent_by_idObject



14
15
16
# File 'app/controllers/concerns/hyrax/parent_container.rb', line 14

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

#lookup_parent_from_childObject



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

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

#parentObject

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



10
11
12
# File 'app/controllers/concerns/hyrax/parent_container.rb', line 10

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

#parent_idObject



25
26
27
# File 'app/controllers/concerns/hyrax/parent_container.rb', line 25

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