0

Hello I am trying to deploy my Rails app on heroku and non of my images or videos are showing when I deploy into production

gem 'rails', '~> 6.0.3', '>= 6.0.3.4'
...
gem 'react-rails'

here is a snippet of one of my image files

 <Carousel>
                <Carousel.Item>
                  <img src="assets/kevin-ku-w7ZyuGYNpRQ-unsplash.jpg" className="d-block w-100 carousel-img"
                  alt="first"/>
                </Carousel.Item>
</Carousel>

Everything shows up fine in development mode. Is there something I need to do to the asset pipeline before deploying to heroku?

CJG
  • 457
  • 2
  • 17
  • Why don't you use any Rails helper such as `<%= image_tag 'kevin-ku-w7ZyuGYNpRQ-unsplash.jpg' %>` or `<%= image_pack_tag 'kevin-ku-w7ZyuGYNpRQ-unsplash.jpg' %>` (if you serve images with webpack); All your assets are fingerprinted in production then the name of the image changes as well. When you use a Rails helper the prodcution name will be resolved towards the origina lname thanks to a resolving table called `manifest.json` in the public folder. – Maxence Nov 07 '20 at 12:44
  • On my local server the <%= and %> are being interpreted as their ascii characters %3C and %3E. Any ideas? – CJG Nov 08 '20 at 19:55
  • I don't use React so I am not too sure. But afaik even in React there is some html tags. Then you have to be able to use Ruby on views. You better google that issue. – Maxence Nov 08 '20 at 19:59

0 Answers0