-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a custom validation method to validate the uniqueness of name
The intention of this change is to address the the following deprecation seen on Rails 6: DEPRECATION WARNING: Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1. To continue case sensitive comparison on the :name attribute in ActsAsTaggableOn::Tag model, pass `case_sensitive: true` option explicitly to the uniqueness validator. Since there is the complexity of the config `ActsAsTaggableOn.strict_case_match`, we can't just explicitly set case_sensitive option as suggested in the deprecation warning. The tests are quite blargh to deal with since the test database has the collation set to case-insensitive and has an uniqueness index, which is not realistic. To deal with the tests, I used a similar approach as in cb8d6e6. In cases where case sensitivity matters, we alter the collation on `name` column, run the test, then alter the collation back.
- Loading branch information
Hector Zhao
committed
Oct 30, 2020
1 parent
47da503
commit 370a55c
Showing
4 changed files
with
107 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters