New Discussion

Notifications

You’re not receiving notifications from this thread.

Why the automated deployment from GitHub to DigitalOcean, will change the image urls in my RubyOnRails app?

0
Rails

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?

Join the discussion
Create an account Log in

Learning Ruby on Rails? Join our newsletter.

We won't send you spam. Unsubscribe at any time.