2015-04-23 85 views
2

我有軌4.2工作正常發展,但在生產ENV我有以下警告:資產管道棄用警告tsort.rb:226

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)

但是我沒有配置.serve_static_assets在我的應用程序配置。它可能在某處配置。

請幫助如何擺脫這一點。提前致謝。

+0

「配置選項'config.serve_static_assets'已重命名爲'config.serve_static_files' ...請相應地遷移您的配置文件。「所以做它說的。進入你的配置文件並將'serve_static_assets'改爲'serve_static_files'。 –

回答

7

你得到棄用警告最有可能由另一顆寶石引起那就是爲你設置配置。對我而言,我們使用的是rails_serve_static_assets,我們使用的版本是0.0.2。要刪除棄用警告,只需更新寶石(問題已被固定在0.0.3版)

bundle update rails_serve_static_assets 
+0

對我來說,這不是因爲這個寶石,而是'bundle update'解決了問題 –

+0

嗯,你應該試着弄清楚當你運行'bundle update'時更新哪些寶石,並且一次只嘗試更新一個寶石。如果解決了這個問題,請將其作爲另一個答案。這很可能會幫助其他用戶。 – jvnill

5

打開您的環境文件。根據您所在的環境(無論是environments/production.rbenvironments/development.rbenvironments/test.rb)。

變化

config.serve_static_assets 

config.serve_static_files 
0

我也面臨着同樣的問題,這似乎是一個警告,而不是一個錯誤,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