When you happen to check if the attribute's value is unique before it is saved, you can use active record validation helper uniqueness. class User < ApplicationRecord validates :mobile_number, uniqueness: true end What if mobile_number is allowed ...
Markdown supported · ⌘↵ to post
No responses yet.