Sha256: 1d2a015309cf831be98e6845b86137ed3c9f707d7fd88d9c7ae16850d43ef4c3

Contents?: true

Size: 806 Bytes

Versions: 69

Compression:

Stored size: 806 Bytes

Contents

require 'active-fedora'
module Cul::Hydra::Controllers
module AggregatorControllerHelper
  def load_fedora_document
    if params.has_key? :asset_id
      af_base = ActiveFedora::Base.load_instance(params[:asset_id])
    else
      af_base = ActiveFedora::Base.load_instance(params[:id])
    end
    the_model = ActiveFedora::ContentModel.known_models_for( af_base ).first
    if the_model.nil? or the_model == ActiveFedora::Base
      the_model = DcDocument
    end

    @document_fedora = af_base.adapt_to the_model
  end
  def load_resources
    @document_fedora ||= load_fedora_document
    if @document_fedora.is_a? Cul::Hydra::ActiveFedora::Model::Aggregator
      @resources = @document_fedora.resources
    else
      logger.debug "Only aggregators have parts!"
    end
    @resources
  end
end
end

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
cul_hydra-1.8.0 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.6 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.5 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.4 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.3 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.2 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.1 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.7.0 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.6.4 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.6.2 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.6.1 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.6.0 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.5.3 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.5.2 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.5.1 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.5.0 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.18 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.17 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.16 lib/cul_hydra/controllers/aggregator_controller_helper.rb
cul_hydra-1.4.15 lib/cul_hydra/controllers/aggregator_controller_helper.rb