import - Importing old data with Rails and Paperclip -


I am using paperclip for attachments in my application. I am writing an import script for a group of old data, but I do not know how to create paperclop objects from files on disk. My first estimate is to create fake CGI Multipart Objects, but it seems like a raw solution, and my initial attempt failed, I think because I did not find the _tempfile method correctly.

Is that the right way to do this? It looks like something that should be quite easy.

I know that I have done the same thing, and I believe that I In the path created a file object, and it has passed the image attribute. The paperclip will run on that file:

  thing.image = File.new ("/ path / to / file.png") thing.save  

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -