gpt4 book ai didi

ruby-on-rails - 在 Heroku 区域设置弃用警告上部署 Rails 4.0.2

转载 作者:行者123 更新时间:2023-12-04 05:49:43 27 4
gpt4 key购买 nike

我已经更新到 Rails 4.0.2 并且收到弃用警告:

[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.

为了摆脱警告,我决定设置:

I18n.config.enforce_available_locales = true
config.i18n.default_locale = :es

在我的 config/application.rb 文件中。

它适用于开发,但是当我将我的工作部署到 Heroku 时,出现以下错误:

-----> Writing config/database.yml to read from DATABASE_URL
-----> Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
:es is not a valid locale
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/i18n-0.6.9/lib/i18n.rb:288:in `enforce_available_locales!'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/i18n-0.6.9/lib/i18n/config.rb:32:in `default_locale='
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/i18n-0.6.9/lib/i18n.rb:35:in `default_locale='
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/i18n_railtie.rb:41:in `block in initialize_i18n'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/i18n_railtie.rb:34:in `each'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/i18n_railtie.rb:34:in `initialize_i18n'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/i18n_railtie.rb:15:in `block in <class:Railtie>'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `call'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:36:in `execute_hook'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `each'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application/finisher.rb:62:in `block in <module:Finisher>'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/config/environment.rb:5:in `<top (required)>'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `block in require'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:214:in `load_dependency'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/activesupport-4.0.2/lib/active_support/dependencies.rb:229:in `require'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/railties-4.0.2/lib/rails/application.rb:250:in `block in run_tasks_blocks'
/tmp/build_e6bd0f83-f9f7-45ad-9d98-13384d9403dc/vendor/bundle/ruby/2.1.0/gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:54:in `block (2 levels) in define'

有什么办法可以避免这个错误吗?

谢谢

最佳答案

我认为如果您先设置 config.i18n.available_locales = [:es] 应该可以。

关于ruby-on-rails - 在 Heroku 区域设置弃用警告上部署 Rails 4.0.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20938414/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com