1

When the user A submits california, it saves this as new record.
Then if the user B submits California, it saves this as new record, too.

I don't want that:( I want it recognize as the same string even when if it's in upper case or lower case.

Is it possible?

My current code is just like this.

models/community.rb

validates_uniqueness_of :name, :message => "is already existing. Please type something else!" 
4

1 回答 1

2

uniqueness validator has a case_sensitive option which you can set to false. More of it in the documentation.

于 2013-03-30T15:41:34.800 回答