I purged a bunch of attachments in development, and it deleted all of them from production. For example, User.find(1).avatar.purge removed the attached avatar in development, but also removed the file from S3. So, now the associated record in production has a broken img.
confirmed (just to be sure) that Rails.env does return development.
I confirmed storage.yml local is:
local:
service: Disk
root: <%= Rails.root.join("storage") %>
development.rb has:
config.active_storage.service = :local
Is there a setting or something I missed? Why would this happen?
This is not necessarily a bug in Rails, although it is a bit unexpected. I submitted an issue for this and got a great response. Basically, the way to proceed to is to name each bucket using Rails.env. That way, when calling purge in dev AS won't find the image. Seems odd that Rails would have this loose end. But, for now...it does.
issue: https://github.com/rails/rails/issues/42186