• ruby on Rails »
  • [deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.

rails4: console display deprecated

In order to silence the warning edit the application.rb file and include the following line inside the Rails::Application body

config.i18n.enforce_available_locales = true

Note:

The old default behavior corresponds to false, not true.
If you are setting the config.i18n.default_locale configuration or other i18n settings, make sure to do it after setting the config.i18n.enforce_available_locales setting.
If your use third party gems that include I18n features, setting the variable through may not have effect. In this case, set it directly to I18n using I18n.config.enforce_available_locales.
Caveats

http://stackoverflow.com/questions/20361428/rails-i18n-validation-deprecation-warning

This entry was posted in ruby on Rails

Leave a Reply

电子邮件地址不会被公开。

您可以使用这些 HTML 标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">