资产管道DEPRECATION WARNING tsort.rb:226

cha*_* ly 2 ruby-on-rails asset-pipeline

我有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.它可能在某处配置.

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

jvn*_*ill 7

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

bundle update rails_serve_static_assets
Run Code Online (Sandbox Code Playgroud)


dda*_*son 6

打开您的环境文件.(或者environments/production.rb,environments/development.rb,environments/test.rb),这取决于您所在的环境.

更改

config.serve_static_assets
Run Code Online (Sandbox Code Playgroud)

config.serve_static_files
Run Code Online (Sandbox Code Playgroud)