I have a problem with including images in my views using Ruby on Rails Webpacker. When i try to insert image in my view using html img tag and asset_pack_path i got an error. My
I had an issue with getting images to show up in Rails 6. I did this:
Add image to
assets/custom_folder/img_filename.file_extension
Uncomment two lines in javascript/packs/application.js
const images = require.context('../images', true)
const imagePath = (name) => images(name, true)
Then add your image to your erb file using this: (I had an index.html.erb view file)
<%= image_tag("custom_folder/file_name.file_extension")%>
This worked for me, hope it helped.
Check out this link