Viktor Emilov

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

I have Ruby On Rails (version 6) app deployed in DigitalOcean, I am using ActionText for the images, the images are stored in DOSpaces.

I display them in the following way in file _blob.html.erb <%= image_tag "https://bucketname.ams3.cdn.digitaloceanspaces.com/#{blob.key}", width:"75%" %>.

So the problem is every time when I push new changes to GH, and automated deployment to DO is finished, the image URLs are changing from https://bucketname.ams3.cdn.digitaloceanspaces.com/eervq9p7jvgib1xv5b3gn3yznw7h

to

https://bucketname.dev/rails/active_storage/blobs/eyJfcmFpbMHiOnsibWVzc2FnZSI6IkJBaHBJdz09IiwiZXhdIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--9583e973a78dfe6588daa5af8c0d4cda5d3c1fa8/3532792.png

When I upload an image from browser it's ok, but after every time I push to GH their URLs are changing and then I got code 404 for all of them.

Do you know why this happens? How can I avoid this from happening and what do you think is the best practice in this sort of situation?

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.