我正要在视图中添加index.png
并收到此错误。我已将文件放入app/assets/images/index.png
Sprockets::Rails::Helper::AssetNotPrecompiled in Maps#new
Showing /home/sumin/sumin/project/tourism-board/app/views/maps/new.html.slim where line #9 raised:
Asset was not declared to be precompiled in production.
Add `Rails.application.config.assets.precompile += %w( index.png )` to `config/initializers/assets.rb` and restart your server
Extracted source (around line #33):
url_for establishment.avatar.variant(resize: ' 10x10 ')
else
image_url 'index.png'
end
end
end
Rails.root: /home/sumin/sumin/project/tourism-board
Application Trace | Framework Trace | Full Trace
app/helpers/application_helper.rb:33:in `establishment_marker_url'
app/views/maps/new.html.slim:9:in `block in _app_views_maps_new_html_slim___2128975323729843504_70193639517680'
app/views/maps/new.html.slim:7:in `map'
app/views/maps/new.html.slim:7:in `_app_views_maps_new_html_slim___2128975323729843504_70193639517680'
答案 0 :(得分:0)
我不知道为什么,但是我通过将资产名称从index.png
更改为marker.png
来解决了这个问题。我认为不应该是index.png
。名称为index