Ruby on rails 自定义design中的空白错误
现在我得到一个类似这样的错误:Ruby on rails 自定义design中的空白错误,ruby-on-rails,error-handling,devise,customization,Ruby On Rails,Error Handling,Devise,Customization,现在我得到一个类似这样的错误: Email can't be blank 我可以只改变这一部分 can't be blank errors: messages: blank: cannot be empty 但在这之后,它表现为: Email cannot be empty 我也可以更改字段名吗?像 E-mail_something_else cannot be empty? 我怎么做 表格中的我的字段: <div class="field">
Email can't be blank
我可以只改变这一部分
can't be blank
errors:
messages:
blank: cannot be empty
但在这之后,它表现为:
Email cannot be empty
我也可以更改字段名吗?像
E-mail_something_else cannot be empty?
我怎么做
表格中的我的字段:
<div class="field">
<%= t('registration.email') %><br />
<%= f.email_field :email, autofocus: true, :class => "form-field" %>
</div>
“表单字段”%>
您只需搜索所需的标签,例如,如果您搜索:已确认的
(即区域设置文件中的标签),您将在文件中找到:
lib/devise/models/confirmable.rb
有这样一条线:
self.errors.add(:email, :already_confirmed)
如果您想按任意键更改电子邮件
编辑:
我正在他们的github repo中搜索,所以我不是用户。这是对的,但您需要的消息可能在文件中:
lib/devise/models/authenticatable.rb
第269行
record.errors.add(key, value.present? ? error : :blank)
您只需搜索所需的标签,例如,如果您搜索
:已确认的(即区域设置文件中的标签),您将在文件中找到:
lib/devise/models/confirmable.rb
有这样一条线:
self.errors.add(:email, :already_confirmed)
如果您想按任意键更改电子邮件
编辑:
我正在他们的github repo中搜索,所以我不是用户。这是对的,但您需要的消息可能在文件中:
lib/devise/models/authenticatable.rb
第269行
record.errors.add(key, value.present? ? error : :blank)
您只需搜索所需的标签,例如,如果您搜索:已确认的(即区域设置文件中的标签),您将在文件中找到:
lib/devise/models/confirmable.rb
有这样一条线:
self.errors.add(:email, :already_confirmed)
如果您想按任意键更改电子邮件
编辑:
我正在他们的github repo中搜索,所以我不是用户。这是对的,但您需要的消息可能在文件中:
lib/devise/models/authenticatable.rb
第269行
record.errors.add(key, value.present? ? error : :blank)
您只需搜索所需的标签,例如,如果您搜索:已确认的(即区域设置文件中的标签),您将在文件中找到:
lib/devise/models/confirmable.rb
有这样一条线:
self.errors.add(:email, :already_confirmed)
如果您想按任意键更改电子邮件
编辑:
我正在他们的github repo中搜索,所以我不是用户。这是对的,但您需要的消息可能在文件中:
lib/devise/models/authenticatable.rb
第269行
record.errors.add(key, value.present? ? error : :blank)
我建议您是否要更改Desive的验证消息
下面是en.yml的外观
en:
activerecord:
errors:
models:
user:
attributes:
email:
blank: "Please Specify an Email id"
taken: "Please use a different Email id"
invalid: "Please Specify a valid Email id"
password:
blank: "Please Specify a Password"
confirmation: "Password does not match"
password_confirmation:
blank: "Please Specify a Password Confirmation"
first_name:
blank: "Please Specify First Name"
last_name:
blank: "Please Specify Last Name"
pdf:
attributes:
name:
blank: "Please Specify name to PDF"
taken: "Please use different name for PDF"
attachment:
blank: "Please Upload a PDF Attachment"
data_element:
attributes:
name:
blank: "Please give Element a desired name"
taken: "Already Created Element with given name"
color:
blank: "Please assign a color to Element"
template:
attributes:
name:
blank: "Please Specify a Name"
taken: "Please use a different name"
示例=>我删除了上面的设计验证模块,然后在用户模型中替换了您自己的模块
希望这将对您有所帮助。如果您想更改Desive的验证消息,我建议您这样做
下面是en.yml的外观
en:
activerecord:
errors:
models:
user:
attributes:
email:
blank: "Please Specify an Email id"
taken: "Please use a different Email id"
invalid: "Please Specify a valid Email id"
password:
blank: "Please Specify a Password"
confirmation: "Password does not match"
password_confirmation:
blank: "Please Specify a Password Confirmation"
first_name:
blank: "Please Specify First Name"
last_name:
blank: "Please Specify Last Name"
pdf:
attributes:
name:
blank: "Please Specify name to PDF"
taken: "Please use different name for PDF"
attachment:
blank: "Please Upload a PDF Attachment"
data_element:
attributes:
name:
blank: "Please give Element a desired name"
taken: "Already Created Element with given name"
color:
blank: "Please assign a color to Element"
template:
attributes:
name:
blank: "Please Specify a Name"
taken: "Please use a different name"
示例=>我删除了上面的设计验证模块,然后在用户模型中替换了您自己的模块
希望这将对您有所帮助。如果您想更改Desive的验证消息,我建议您这样做
下面是en.yml的外观
en:
activerecord:
errors:
models:
user:
attributes:
email:
blank: "Please Specify an Email id"
taken: "Please use a different Email id"
invalid: "Please Specify a valid Email id"
password:
blank: "Please Specify a Password"
confirmation: "Password does not match"
password_confirmation:
blank: "Please Specify a Password Confirmation"
first_name:
blank: "Please Specify First Name"
last_name:
blank: "Please Specify Last Name"
pdf:
attributes:
name:
blank: "Please Specify name to PDF"
taken: "Please use different name for PDF"
attachment:
blank: "Please Upload a PDF Attachment"
data_element:
attributes:
name:
blank: "Please give Element a desired name"
taken: "Already Created Element with given name"
color:
blank: "Please assign a color to Element"
template:
attributes:
name:
blank: "Please Specify a Name"
taken: "Please use a different name"
示例=>我删除了上面的设计验证模块,然后在用户模型中替换了您自己的模块
希望这将对您有所帮助。如果您想更改Desive的验证消息,我建议您这样做
下面是en.yml的外观
en:
activerecord:
errors:
models:
user:
attributes:
email:
blank: "Please Specify an Email id"
taken: "Please use a different Email id"
invalid: "Please Specify a valid Email id"
password:
blank: "Please Specify a Password"
confirmation: "Password does not match"
password_confirmation:
blank: "Please Specify a Password Confirmation"
first_name:
blank: "Please Specify First Name"
last_name:
blank: "Please Specify Last Name"
pdf:
attributes:
name:
blank: "Please Specify name to PDF"
taken: "Please use different name for PDF"
attachment:
blank: "Please Upload a PDF Attachment"
data_element:
attributes:
name:
blank: "Please give Element a desired name"
taken: "Already Created Element with given name"
color:
blank: "Please assign a color to Element"
template:
attributes:
name:
blank: "Please Specify a Name"
taken: "Please use a different name"
示例=>我删除了上面的设计验证模块,然后在用户模型中替换了您自己的模块
希望这将对您有所帮助。在design_en.yml
文件中尝试以下内容:
en:
errors:
format: "%{message}"
默认格式为“%{attribute}%{message}”。在designe_en.yml
文件中尝试以下操作:
en:
errors:
format: "%{message}"
默认格式为“%{attribute}%{message}”。在designe_en.yml
文件中尝试以下操作:
en:
errors:
format: "%{message}"
默认格式为“%{attribute}%{message}”。在designe_en.yml
文件中尝试以下操作:
en:
errors:
format: "%{message}"
默认格式为“%{attribute}%{message}”。修改文件后是否重新启动了服务器?能否请您通过查看form@ArslanAli对我确实重新开始了it@AnantKolvankar我在我的问题中添加了一个字段代码我需要显示错误消息的方法修改文件后重新启动服务器吗?请通过查看form@ArslanAli对我确实重新开始了it@AnantKolvankar我在我的问题中添加了一个字段代码我需要显示错误消息的方法修改文件后重新启动服务器吗?请通过查看form@ArslanAli对我确实重新开始了it@AnantKolvankar我在我的问题中添加了一个字段代码我需要显示错误消息的方法修改文件后重新启动服务器吗?请通过查看form@ArslanAli对我确实重新开始了it@AnantKolvankar我在问题中添加了一个字段代码我需要您用来显示错误消息的方法比我的解决方案更清晰:比我的解决方案更清晰:比我的解决方案更清晰:@Orkhan:请参考此链接。它打印:电子邮件请指定电子邮件id
=/@Orkhan:请参考此链接。它打印:电子邮件请指定电子邮件id
=/@Orkhan:请参考此链接。它打印:电子邮件请指定电子邮件id
=/@Orkhan:请参考此链接。它打印:电子邮件请指定电子邮件id
=/