Hey, I have the requirement to split uploaded pdf files into single pages and store each as a separate record, so they can be individually approved or deleted.
Currently I'm detecting the number of pages via ghostscript before I store the model and if I have more than 1 page, I split the attachment in an after_save callback.
However splitting from after_save is error prone and can lead to splitting the same file multiple times. I'm also splitting and processing in the background via a separate worker.
My first approach was to split via :process on the uploader, but I discarded it, because the processing hook was called for each version.
So, is there a way to have a processing hook on the uploader executed only once and not for each version? Also it shouldn't be called again on recreate_versions!