Wanted to see if anyone knows of a way - or the preferred way - to do these three tasks with Paperclip:
- Access the content of an uploaded file before save. I did find that the following works before save, but is there a clearer way to do this:
self.uploaded_file.queued_for_write[:original].open.read
-
Access the content of a file after save while my AR model instance is still alive and/or when I load a record and need the file content. i.e. do I just need to manually read the file into my object from the Paperclip path, or is there a direct method in Paperclip to do this?
-
(if #2 above is possible), is there a way I can modify the file content and if so, does calling object.save on the Paperclip enabled object after a change save the changes?
Paperclip seems to make everything easy but I can’t seem to find a direct way to do these tasks. Maybe it was not really designed for what I am trying to do but is gets me pretty far along.
Thanks in advance,
David