David Kahn
2010-Aug-22 23:51 UTC
Paperclip - possible to modify file and load file content as string?
Wanted to see if anyone knows of a way - or the preferred way - to do these three tasks with Paperclip: 1) 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 2) 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? 3) (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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.