Where should I put ActiveStorage purge methods in the controller?
I'm trying to figure out where the best place to put ActiveStorage purge methods in the controller. I have tried a few things, but nothing feels really right. Originally, I had them set up as custom endpoints with purge methods, but having them on each resource with files was a little bit tedious. At the moment, I am piggybacking them onto the delete method of each controller with a conditional (one branch handles deleting attachments, the other deleting the object) which looks ugly, but keeps the routes and methods clean.
Something I haven't tried would be to write a stand-alone controller/endpoint to handle all purging under a single destroy method. Seems weird though to write a controller to interface with a method that's built into Rails now. Maybe I am missing something about how AS is supposed to be implemented?