The asset "image.jpg" is not present in the asset pipeline

Viewed 4923

I am trying to follow Agile development using rails 5.0 book. There I have loaded images inside app/assets/images directory manually just as told in the book.

Following is the line where it is showing error.

      <%= image_tag(product.image_url, class: 'list_image') %>

As I mentioned I loaded images called for ex image.jpg, and it throwing

ActionController exception caught

Sprockets::Rails::Helper::AssetNotFound in Products#index

The asset "image.jpg" is not present in the asset pipeline.

When I checked in db seeded there is a image with url image.jpg but it is throwing error.

2 Answers

I ran into this issue myself whilst following the book. You need to ensure that you have a file called image.jpg in the location app/assets/images. It's no good just having the filename in the image_url field in the database.

Remember to run bin/rails db:seeds after making changes to the seeds.rb file. Seems straight forward but as a new developer I sometimes forget (for about 30 mins) and wonder why it's not working.

Related