-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Change how validate_uniqueness_of
query works
#368
Comments
Switching to this style would remove the ability to change how the value is searched by. If you wanted to check for the uniqueness of a string case insensitively you can do |
That’s a good point. Maybe we allow either one? So you can return a criteria if you want to customize but it is not required. What do you think? |
This is the link to the avram_slugify that should be referenced https://github.com/luckyframework/avram_slugify/blob/be75b34e358e6dc2f6d9ad8d9ed079754b945ad2/src/avram_slugify.cr#L29 |
So it uses a query and doesn't end with a criteria. When I originally wrote this I didn't know how else to do it. But I figured out a better way to do it in AvramSlugify.
Now
After
Do this by using the passed in attribute's name and a raw where. Still (mostly) type-safe because the attribute is typed and auto-generated by the model
The text was updated successfully, but these errors were encountered: