Rails validates uniqueness 空值处理?

sunsonavaj · September 25, 2012 · Last by sunsonavaj replied at September 25, 2012 · 2341 hits

我这样一个案例,我 models 校验该属性为数据库唯一: `validates :custome_code,:uniqueness => {:scope => :deleted_at}, :allow_nil => true 但是 allow_nil 没有生效,我修改保存他说重复,我明明是空的。

:allow_blank => true

OK , Thank you !

You need to Sign in before reply, if you don't have an account, please Sign up first.