gpt4 book ai didi

ruby-on-rails - 为什么我得到 "Unknown validator: ' MessageValidator'"?

转载 作者:行者123 更新时间:2023-12-03 10:08:24 26 4
gpt4 key购买 nike

我收到这个错误

Unknown validator: '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"}

关于ruby-on-rails - 为什么我得到 "Unknown validator: ' MessageValidator'"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14451800/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com