Why doesn't Rails' “errors.full_messages” replace attribute and message variables?

后端 未结 8 1678
小鲜肉
小鲜肉 2020-12-09 16:22

Having a strange problem with a rails model I just created.

Here are my validations:

validates_presence_of :from_name, :message => \'Please provid         


        
8条回答
  •  隐瞒了意图╮
    2020-12-09 16:55

    I ran into this problem as well with an old 2.3.5 Rails app that I inherited. I had the 5.0 version of the i18n gem installed. I saw that it needs the %{} syntax. Doing this in config/locales/en.yml did the trick:

    
    en:
      activerecord:
        errors:
          full_messages:
            format: "%{attribute} %{message}"
    

提交回复
热议问题