Created
June 16, 2020 14:44
-
-
Save ritikesh/465b69314bce378a9bedaa17d2ffa8e5 to your computer and use it in GitHub Desktop.
blog gists
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
# Before | |
class User < ActiveRecord::Base | |
validates_uniqueness_of :username, message: :taken | |
end | |
# After | |
class User < ActiveRecord::Base | |
handle_record_not_unique(field: ["username"], message: {username: :taken}) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment