Class: HydraEditor::ControllerResource

Inherits:
CanCan::ControllerResource
  • Object
show all
Defined in:
lib/hydra_editor/controller_resource.rb

Instance Method Summary collapse

Instance Method Details

#find_resourceObject



2
3
4
# File 'lib/hydra_editor/controller_resource.rb', line 2

def find_resource
  ActiveFedora::Base.find(id_param)
end

#has_valid_type?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/hydra_editor/controller_resource.rb', line 11

def has_valid_type?
  HydraEditor.valid_model? type_param
end

#resource_classObject



6
7
8
9
# File 'lib/hydra_editor/controller_resource.rb', line 6

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

#type_paramObject



15
16
17
# File 'lib/hydra_editor/controller_resource.rb', line 15

def type_param
  @params[:type]
end