Skip to content

Commit

Permalink
Rearrange code to allow fallback to alternative_id
Browse files Browse the repository at this point in the history
  • Loading branch information
LaRita Robinson committed Oct 14, 2024
1 parent 1e73fb6 commit 8f5592a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 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,9 @@ def self.for_class?(member_class)
#
# @raise Hyrax::ObjectNotFoundError
def self.find(_model_class, id)
Hyrax.query_service.find_by(id: id) ||
Hyrax.query_service.find_by_alternate_identifier(alternate_identifier: id)
Hyrax.query_service.find_by(id: id)
rescue Valkyrie::Persistence::ObjectNotFoundError
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 8f5592a

Please sign in to comment.