We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ActiveRecord's built-in uniqueness validation does not account for records deleted by paranoid2.
The text was updated successfully, but these errors were encountered:
a workaround is to use:
uniqueness: { conditions: -> { where(deleted_at: nil) } }
instead of:
uniqueness: true
Sorry, something went wrong.
Uniqueness validator by default uses unscoped scope
unscoped
Not sure if we need to change this. You won't be able to restore deleted record (it would be invalid)
actasparanoid has solved this by adding a custom uniqueness validator.
its use:
validates_uniqueness_of_without_deleted :name
istead of:
validates_uniqueness_of :name
@loureirorg you can use following scope to make code a little bit cleaner for now.
uniqueness: { conditions: -> { paranoid_scope } }
I will think more about this validator.
Thank you for your report
No branches or pull requests
ActiveRecord's built-in uniqueness validation does not account for records deleted by paranoid2.
The text was updated successfully, but these errors were encountered: