Santosh Aryal
Santosh Aryal

Reputation: 1376

Rails ActiveStorage images disappears

Active Storage image attachments disappears after some couple of minutes in production environment. I am able to upload the images, it appears for some minutes then disappears.

In local it says 'Image cannot be displayed because it contains error' and in Google Storage it says like 'The provided token has expired'.

I am using rail 5.2.3 and Ruby 2.6.0.

Upvotes: 1

Views: 567

Answers (1)

enjaku
enjaku

Reputation: 346

Seems like you're using a temporary url, try using url_for helper, it should give you a public permanent url.

https://edgeguides.rubyonrails.org/active_storage_overview.html#linking-to-files

Or rails_blob_url for downloading and rails_representation_url for attachment variants.

Upvotes: 1

Related Questions