skip to Main Content

I’ve setup ActiveStorage and ActionText by following the official guides. I can attach images and videos in local environment(localhost:3000). All the things are working well, even after I restart the server.
enter image description here

So I deploy my code change to staging. It looks all good when creating the blog. But I found if I redeploy the code(rebuild the docker image and start service by docker-compose up). The attachments for ActionText will just been invalid, which looks like this:
enter image description here

2

Answers


  1. Chosen as BEST ANSWER

    Finally I found the root case is: https://github.com/rails/rails/issues/37405

    It's a Rails bug, when we are using rich_text_area_tag, here will be the problem.

    If you use rich_text_area instead this problem will not be there any more.


  2. I had a similar problem that was caused by me not configuring docker-compose correctly. I had:

    1. Selected Disk for the ActiveStorage "service". This is OK because I don’t expect that my app will store tons of stuff using ActiveStorage–just ActionText blobs in a very limited way.
    2. I didn’t set up the volume for the ActiveStorage Disk service to be persistent across restarts. Every time I deployed or otherwise restarted the docker-compose services, the volume was recreated, erasing every ActionText blob.

    Once I properly configured a persistent volume for ActiveStorage, the ActionText attachments started working across deploys/restarts.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search