Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.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 Rails 3是否使用区域设置来显示错误消息?_Ruby On Rails_Ruby_Error Handling - Fatal编程技术网

Ruby on rails Rails 3是否使用区域设置来显示错误消息?

Ruby on rails Rails 3是否使用区域设置来显示错误消息?,ruby-on-rails,ruby,error-handling,Ruby On Rails,Ruby,Error Handling,因此,我的订单表中有一个名为b_name的列名。但是,当我收到错误消息时,它说B name不能为空。我的b_name列是企业名称的缩写。是否可以使用区域设置将我的列b_name更改为企业名称。如果是这样,你能提供一个教程或给我一个例子吗。我尝试过以下几种方法: en: activerecord: models: model_name: "Order" attributes: model_name: b_name:

因此,我的订单表中有一个名为
b_name
的列名。但是,当我收到错误消息时,它说
B name不能为空
。我的b_name列是企业名称的缩写。是否可以使用区域设置将我的列
b_name
更改为企业名称。如果是这样,你能提供一个教程或给我一个例子吗。我尝试过以下几种方法:

en:
  activerecord:
    models:
      model_name:          "Order"
    attributes:
      model_name:
        b_name:            "Business Name"
这并没有改变错误信息。我甚至试过:

HUMANIZED_ATTRIBUTES = {
  :lname => ""
}
def self.human_attribute_name(attr)
  HUMANIZED_ATTRIBUTES[attr.to_sym] || super
end
但是在第3行收到一条错误消息,说参数的数量错误(2对1)

1:
2:   
**3**:      
4:这是禁止的
5:从被保存开始:
6:以下字段存在问题:

有什么建议可以帮我完成任务吗

提前谢谢

1: <% if object.errors.any? %>
2:   <div id="error_explanation">
**3**:     <h2><%= pluralize(object.errors.count, "error") %> 
4:         prohibited this <%= object.class.to_s.underscore.humanize.downcase %> 
5:         from being saved:</h2>
6:     <p>There were problems with the following fields:</p>