开发者

Rails I18n Errors

I am reading I18N for Active Record Models but I can't get an attribute on my model to display correctly.

I have a model like this:

class Tran < ActiveRecord::Base
    validates :description, :presence => true,
                            :length => {:maximum => 100 }
end

and a en.yml file like this:

en:
  activerecord:
    attributes:
      tran:
        description: "Description"
    errors:
      models:
        tran:
          attributes:
            description:
  errors:
    messages:
      blank: "can't be blank!"

When I show the error message on the client, the "can't be blank!" successfully shows up, but the description does not change to "Description" like I would expect. What am I doing wrong?

Thanks开发者_Python百科.


This is pretty relevant to what you want :

How to change validation messages on forms

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜