Skip to content

Commit

Permalink
Remove reliance on noid for find
Browse files Browse the repository at this point in the history
Switches from using noids to using a fallback... look first by id,
and then by alternate_identifier instead.

I created a work in dassie with VALKYRIE_TRANSITION=true and then I was
unable to edit the work because I don’t have an alternative identifier.
  • Loading branch information
laritakr committed Oct 14, 2024
1 parent 0ffde70 commit 1e73fb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/hyrax/valkyrie_can_can_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ 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?
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id)
Hyrax.query_service.find_by(id: id) ||
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id)
rescue Valkyrie::Persistence::ObjectNotFoundError => err
raise Hyrax::ObjectNotFoundError, err.message
end
Expand Down

0 comments on commit 1e73fb6

Please sign in to comment.