资产管道DEPRECATION WARNING tsort.rb:226

我有rails 4.2在开发上工作正常但在生产环境中我有以下警告:

DEPRECATION WARNING: The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. (called from block in tsort_each at /home/xxx/.rbenv/versions/2.2.1/lib/ruby/2.2.0/tsort.rb:226)

但是我的app配置中没有config.serve_static_assets。 它可能在某处配置。

请帮助如何摆脱这个。 提前致谢。

您获得的弃用警告很可能是由为您设置该配置的另一个gem引起的。 对我来说,我们使用的是rails_serve_static_assets ,我们使用的是版本0.0.2 。 要删除弃用警告,只需更新gem(问题已在版本0.0.3

 bundle update rails_serve_static_assets 

打开您的环境文件。 ( environments/production.rbenvironments/development.rbenvironments/test.rb )取决于您所处的环境。

更改

 config.serve_static_assets 

 config.serve_static_files 

我遇到了同样的问题,它似乎是一个警告而不是错误,并且根据配置文件,railties会自动将serve_static_assets更新为serve_static_files

路径:
railties-4.2.7 \ LIB \轨道\程序\ configuration.rb

源代码片段:

  # :nodoc: SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE = <<-MSG.squish The configuration option `config.serve_static_assets` has been renamed to `config.serve_static_files` to clarify its role (it merely enables serving everything in the `public` folder and is unrelated to the asset pipeline). The `serve_static_assets` alias will be removed in Rails 5.0. Please migrate your configuration files accordingly. MSG def serve_static_assets ActiveSupport::Deprecation.warn SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE serve_static_files end def serve_static_assets=(value) ActiveSupport::Deprecation.warn SERVE_STATIC_ASSETS_DEPRECATION_MESSAGE self.serve_static_files = value end