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

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -