Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 定制can';在特定型号中,错误消息不能为空_Ruby On Rails - Fatal编程技术网

Ruby on rails 定制can';在特定型号中,错误消息不能为空

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

我有一个叫“视频”的模型

在该模型中,有一个视频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 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."}