Exclude attribute name prepending in error message

后端 未结 1 1747
不思量自难忘°
不思量自难忘° 2021-01-15 15:39

I have a simple internationalization:

attributes:
  user:
    login: Login
errors:
  template:
    header: \"Errors\"
    body: \"\"
  models:
    user:
             


        
1条回答
  •  孤城傲影
    2021-01-15 16:22

    You need to specify the error message format in order to remove the model name. I believe this is only possible as of Rails 3.2.6 and up. There are more details on the I18n chapter in Rails Guides.

    en:
      errors:
        format: "%{message}"
    

    The default is %{attribute} %{message}.

    0 讨论(0)
提交回复
热议问题