Reputation: 367
I have the following problem. I have the model with the following validation
validates :company, presence:true,
uniqueness: true,
format: /^([a-zA-z]+\s?){1,}$
if in the database there is stored a company with the value "Nevada" and after I add a new company with the value "nevada" that validation passes because "Nevada" is not than same that "nevada". How can I do for that the validation not accept case sensitive
Upvotes: 0
Views: 29
Reputation: 6100
You can dfine if it checks for case sensitive
validates :company, presence:true,
uniqueness: {case_sensitive: false},
format: /^([a-zA-z]+\s?){1,}$
Check also rails unique validation
Upvotes: 1