I am recently try to upgrade my application from rails 4.2 to 5.2.8. During the process I am facing one issue i.e asset load error. i.e favicon image loading in the template. Is there any solution to make it work.
The asset “images/logo_big.png” is not present in the asset pipeline.
irb(main):026:0> merchant.site.logo
Site Load (2.9ms) SELECT "sites".* FROM "sites" WHERE "sites"."tenant_id" = $1 ORDER BY "sites"."id" DESC LIMIT $2 [["tenant_id", 40456], ["LIMIT", 1]]
=> {"url"=>"images/logo_big.png", "text"=>"Logo Brand"}
Rails 4.2 - Working fine.
show.html.slim
= favicon_link_tag( merchant.site.logo['url'])
Rails 5.2.8
show.html.slim
= favicon_link_tag( merchant.site.logo['url'] , skip_pipeline: true)
with skip_pipeline - true - working fine without loading the image and template error.
without skip_pipeline - Getting Template error
exception_class=ActionView::Template::Error
exception_message=The asset "images/logo_big.png" is not present in the asset pipeline.
irb(main):035:0> ActionController::Base.helpers.asset_url("logo_big.png")
=> "//cdn.domain.com/assets/logo_big-23c4c190c54ace066d0219583df267dc67cc1117a250d27971c7fc15fcec94ff.png"
irb(main):036:0> ActionController::Base.helpers.asset_url("images/logo_big.png")
Traceback (most recent call last):
1: from (irb):36
Sprockets::Rails::Helper::AssetNotFound (The asset "images/logo_big.png" is not present in the asset pipeline.
)
irb(main):037:0>