Skip to content

Commit

Permalink
Merge branch 'main' into migrate_based_near
Browse files Browse the repository at this point in the history
  • Loading branch information
orangewolf authored Oct 16, 2024
2 parents 1385de2 + 0f522be commit 3d679fd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/hyrax/valkyrie_can_can_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3d679fd

Please sign in to comment.