ruby - Updating the attributes in the rails errors -


i looking update model errors hash rails sent humanized attributes name. example model called foo . have attribute called foo_nm . want translated foo_name when @foo.errors assuming @foo object of class foo.

{"foo_nm"=>["can't blank"]} 

so far tried extend human_attribute_name following way

   humanized_attributes = {     :foo_nm => "foo_name"   }    def self.human_attribute_name(attr, options={})     humanized_attributes[attr.to_sym] || super   end 

but doesnt seem modify errors hash. ideas around on how can update errors hash appreciated

can't inside locale files?

# config/locales/en.yml en:   hello: "hello world"   activerecord:     models:       foo: "foo"     attributes:       foo_nm: "foo_name" 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -