因为我更新了几个gem,所以所有测试都会失败,并出现以下错误:
ActionView::Template::Error:未声明要预编译的assets资源
将
Rails.application.config.assets.precompile += %w( favicons/manifest.json.erb )
添加到config/initializers/assets.rb
,然后重新启动服务器app/views/layouts/_faviconheader.html.雇员再培训局:14:
_app_views_layouts__faviconsheader_html_erb__1320
应用程序/视图/布局/应用程序.html.雇员再培训局:21:
_app_views_layouts_application_html_erb__4340
错误似乎是指包含以下行的第_faviconsheader.html.erb
部分:
<%= content_tag :link, nil, rel: :manifest, href: image_path("favicons/manifest.json.erb") %>
这个部分是在application.html.erb
:<%= render partial: 'layouts/faviconsheader' %>
加载的.
你知道是什么导致了这个错误,该怎么办吗?Before the gem update all tests passed.
我使用Rails 4.2.5.其中一个gems更新为sprockets
(链轮更新为3.5.2版).我在github上读到一些关于链轮4有问题的文章,但我没有使用版本4.
另外,即使我把Rails.application.config.assets.precompile += %w( favicons/manifest.json.erb )
加到config/initializers/assets.rb
,错误仍然存在.但即使这样做有效,我也会想知道为什么会出现这个问题,除了更新一些gems之外,没有任何改变.