Module: Hyrax::ParentContainer
- Extended by:
- ActiveSupport::Concern
- Included in:
- FileSetsController
- Defined in:
- app/controllers/concerns/hyrax/parent_container.rb
Instance Method Summary collapse
- #find_parent_by_id ⇒ Object
- #lookup_parent_from_child ⇒ Object
-
#parent ⇒ Object
TODO: this is slow, refactor to return a Presenter (fetch from solr).
- #parent_id ⇒ Object
Instance Method Details
#find_parent_by_id ⇒ Object
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_child ⇒ Object
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 |
#parent ⇒ Object
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_id ⇒ Object
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 |