Ruby on rails Rails 3.0中的自定义验证消息
当我使用以下验证时:Ruby on rails Rails 3.0中的自定义验证消息,ruby-on-rails,ruby,validation,Ruby On Rails,Ruby,Validation,当我使用以下验证时: validates_length_of :lgtitle, :maximum=>45, :message=>"Please reduce the number of characters used in the Before Like Title. The maximum is 45 characters." Rails在我的视图中返回消息和表行: Lgtitle Please reduce the number of characters used in
validates_length_of :lgtitle, :maximum=>45, :message=>"Please reduce the number of characters used in the Before Like Title. The maximum is 45 characters."
Rails在我的视图中返回消息和表行:
Lgtitle Please reduce the number of characters used in the Before Like Title. The maximum is 45 characters.
消除添加到验证消息中的表行字符串的最佳实践是什么
谢谢。错误消息添加到
模型中。错误
是散列
- 键是列名
- 值,消息本身
我打赌你会同时显示键和值。前段时间有一个类似的问题。以下是链接: