Class: Hyrax::ValkyrieCanCanAdapter
- Inherits:
-
CanCan::ModelAdapters::AbstractAdapter
- Object
- CanCan::ModelAdapters::AbstractAdapter
- Hyrax::ValkyrieCanCanAdapter
- Defined in:
- lib/hyrax/valkyrie_can_can_adapter.rb
Overview
A CanCan::ModelAdapter for valkyrie resources
Class Method Summary collapse
- .find(_model_class, id) ⇒ Hyrax::Resource
- .find_by(id:) ⇒ Object
- .for_class?(member_class) ⇒ Boolean
Class Method Details
.find(_model_class, id) ⇒ Hyrax::Resource
21 22 23 24 25 26 |
# File 'lib/hyrax/valkyrie_can_can_adapter.rb', line 21 def self.find(_model_class, id) self.find_by(id:) || Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id) rescue Valkyrie::Persistence::ObjectNotFoundError => err raise Hyrax::ObjectNotFoundError, err. end |
.find_by(id:) ⇒ Object
30 31 32 33 |
# File 'lib/hyrax/valkyrie_can_can_adapter.rb', line 30 def self.find_by(id:) Hyrax.query_service.find_by(id:) rescue Valkyrie::Persistence::ObjectNotFoundError end |