我得到这个错误
未知验证器:'MessageValidator'
我不知道为什么我得到这个。
我的代码有什么问题?
validates :title,
:presence => true,
:uniqueness => true,
:length => { :maximum => 100 },
:message => "Must be input and has to be less than 100 characters, and unique."
尝试:
validates :title,
:presence => {:message => "Title can't be blank." },
:uniqueness => {:message => "Title already exists."},
:length => { :maximum => 100, :message => "Must be less than 100 characters"}
我假设您希望在长度验证失败时消息为。您应该在该散列中包含消息,如:
validates :title,
:presence => true,
:uniqueness => true,
:length => { :maximum => 100, :message => "Must be less than 100 characters"}