Erik Escobedo
Erik Escobedo

Reputation: 2803

Is it possible to use Paperclip for atacching existing files to a model?

I have a bunch of files in the server and I want to link them to a model with paperclip, since I want to generate the thumbnails and save their info in the database, just as if I uploaded with a form.

Is it possible to use a console command passing the file paths for generating the Paperclip Model?

Upvotes: 1

Views: 362

Answers (1)

Jeff Paquette
Jeff Paquette

Reputation: 7127

There is a rake task (alt link) that shows how to accomplish what you want to do using fixtures. It should be easy to adapt to your needs.

It looks to be as simple as setting the file on your model to the full path to the file, and calling reprocess! See the link for full details

Upvotes: 2

Related Questions