为什么我得到“未知验证器:'MessageValidator'"? [英] Why do I get "Unknown validator: 'MessageValidator'"?

查看:31
本文介绍了为什么我得到“未知验证器:'MessageValidator'"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误

未知验证器:'MessageValidator'

Unknown validator: 'MessageValidator'

我不知道为什么我会得到那个.
我的代码有什么问题?

I have no idea why I'm getting that.
What's wrong with my code?

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"}

这篇关于为什么我得到“未知验证器:'MessageValidator'"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆