Ruby on rails 定制can';在特定型号中,错误消息不能为空
我有一个叫“视频”的模型 在该模型中,有一个视频cid,用于验证是否存在 在表单中,这是一个隐藏字段,当有人录制视频时,该字段会用值更新 当前,当用户不保存视频时,我能够生成错误消息==>Ruby on rails 定制can';在特定型号中,错误消息不能为空,ruby-on-rails,Ruby On Rails,我有一个叫“视频”的模型 在该模型中,有一个视频cid,用于验证是否存在 在表单中,这是一个隐藏字段,当有人录制视频时,该字段会用值更新 当前,当用户不保存视频时,我能够生成错误消息==> Video can't be blank 有什么方法可以完全改变这个句子吗?我想说-> It looks like the video has not been saved. Please record and save your video. 我能够使用locales/en.yml文件将Video C
Video can't be blank
有什么方法可以完全改变这个句子吗?我想说->
It looks like the video has not been saved. Please record and save your video.
我能够使用locales/en.yml文件将Video Cid的名称更改为“Video”
这是我的视频模型:
# == Schema Information
#
# Table name: videos
#
# id :integer not null, primary key
# user_id :integer
# video_cid :string(255)
# question :string(255)
# created_at :datetime
# updated_at :datetime
#
class Video < ActiveRecord::Base
belongs_to :user
validates :user_id, presence: true
validates :question, presence: true
validates :video_cid, presence: true
end
试试这个
validates :video_cid, :presence => {:message => "It looks like the video has not been saved. Please record and save your video."}
在询问新问题之前,请考虑标记适当的答案,提高你的接受率。谢谢,并接受:)。
validates :video_cid, :presence => {:message => "It looks like the video has not been saved. Please record and save your video."}