【发布时间】:2017-06-02 03:54:10
【问题描述】:
我正在将 Rails 5.0.1 应用程序升级到 Rails 5.1 并遇到一些弃用警告。我能够解决除一个以外的所有问题。
我四处寻找,但没有找到明确的答案。
背景
这是一个刚刚完成的应用。我刚刚将 rails 版本更新到 5.1
我有一些 RSpec 请求规范。他们在(设计)登录中测试重定向。此错误显示在这些规范中。
控制器规格运行良好。我在有关 css、js、图像等的请求规范中看到此警告。
我确实在资产管道中有dashboard.js。还有一个app/assets/javascripts/dashboard.coffee 文件。
# config/initializers/assets.rb
Rails.application.config.assets.precompile += %w[
sites.js
sites.css
admin.js
admin.css
header.js
dashboard.js
dashboard.css
setup.js
setup.css
]
警告
这是我看到的警告。
DEPRECATION WARNING: The asset "header.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
(called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:17)
DEPRECATION WARNING: The asset "dashboard.js" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
(called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:18)
DEPRECATION WARNING: The asset "dashboard.css" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
(called from _app_views_layouts_dashboard_html_slim__2366450786595837886_80483400 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard.html.slim:19)
DEPRECATION WARNING: The asset "logos/logo-white.png" is not present in the asset pipeline.Falling back to an asset that may be in the public folder.
This behavior is deprecated and will be removed.
To bypass the asset pipeline and preserve this behavior,
use the `skip_pipeline: true` option.
(called from _app_views_layouts_dashboard__sidebar_html_slim___2324799200884164274_84919380 at /home/ziyan/Work/Brevica/churchfoyer/app/views/layouts/dashboard/_sidebar.html.slim:3)
我尝试了什么
- 手动预编译资产没有解决
感谢有关如何解决此警告的任何建议。
我认为资产管道已被绕过规范。
【问题讨论】:
标签: ruby-on-rails ruby rspec ruby-on-rails-5.1