diff --git a/lib/hyrax/valkyrie_can_can_adapter.rb b/lib/hyrax/valkyrie_can_can_adapter.rb index 70a4786f4f..471106bd11 100644 --- a/lib/hyrax/valkyrie_can_can_adapter.rb +++ b/lib/hyrax/valkyrie_can_can_adapter.rb @@ -19,10 +19,17 @@ def self.for_class?(member_class) # # @raise Hyrax::ObjectNotFoundError def self.find(_model_class, id) - return Hyrax.query_service.find_by(id: id) unless Hyrax.config.enable_noids? + self.find_by(id:) || Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id) rescue Valkyrie::Persistence::ObjectNotFoundError => err raise Hyrax::ObjectNotFoundError, err.message end + + private + + def self.find_by(id:) + Hyrax.query_service.find_by(id:) + rescue Valkyrie::Persistence::ObjectNotFoundError + end end end