Sha256: 641b56eb277290201d92925b985b22ba7470dd3ac2a4070c4c75943bd9cf7edc

Contents?: true

Size: 389 Bytes

Versions: 8

Compression:

Stored size: 389 Bytes

Contents

class HydraEditor::ControllerResource < CanCan::ControllerResource
  def find_resource
    ActiveFedora::Base.find(id_param, cast: true)
  end

  def resource_class
    raise HydraEditor::InvalidType, "Lost the type" unless has_valid_type?
    type_param.constantize
  end

  def has_valid_type?
    HydraEditor.valid_model? type_param
  end

  def type_param
    @params[:type]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hydra-editor-0.5.2 lib/hydra_editor/controller_resource.rb
hydra-editor-0.5.1 lib/hydra_editor/controller_resource.rb
hydra-editor-0.5.0 lib/hydra_editor/controller_resource.rb
hydra-editor-0.4.0 lib/hydra_editor/controller_resource.rb
hydra-editor-0.3.0 lib/hydra_editor/controller_resource.rb
hydra-editor-0.2.2 lib/hydra_editor/controller_resource.rb
hydra-editor-0.2.1 lib/hydra_editor/controller_resource.rb
hydra-editor-0.2.0 lib/hydra_editor/controller_resource.rb