Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
blog gists
# 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