开发者

rails 3 label i18n unexpected behavior

开发者 https://www.devze.com 2023-03-20 23:32 出处:网络
i want to translate a model attribute (post.name). in my view i have label :post, :name in my en.yml i have

i want to translate a model attribute (post.name). in my view i have

label :post, :name

in my en.yml i have

en:
  activerecord:
    attributes:
      post:
        name: "Test"

it works only if i use it in the post-view, but in other views is does not (label-text is "Name" there). Is this intended behavior (this restr开发者_开发知识库iction is not mentioned in the docs), and can i do something about it?


A little late to the game here, just came across your question looking for an answer to another.

Here you go: label :post, :name, Post.human_attribute_name(:name)

0

精彩评论

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