Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lookup Behaviour w Invalid UUID #4

Merged
merged 1 commit into from
Feb 9, 2024
Merged

Lookup Behaviour w Invalid UUID #4

merged 1 commit into from
Feb 9, 2024

Conversation

joel
Copy link
Owner

@joel joel commented Feb 9, 2024

To preserve ActiveRecord default behaviour, we can ignore malformatted UUIDs:

User.find_by(uuid: 'asdf')
=> nil

like

User.find_by(id: 'asdf')
=> nil

turn off the raise of error

UuidV7.configure do |config|
  config.throw_invalid_uuid = false
end

Otherwise it will raise raise_error(UuidV7::Types::InvalidUUID, "asdf is not a valid UUID")

@joel joel self-assigned this Feb 9, 2024
@joel joel merged commit 92cff65 into main Feb 9, 2024
2 checks passed
@joel joel deleted the throw_invalid_uuid branch February 9, 2024 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant