ruby on rails - Add fingerprint to old paperclip attachments -


I use paperclip for attachments on my model. I recently added a fingerprint for the attachment, it works fine with new attachments, but this does not add to the old ones, because of this, because of the problem of reprocessing attachments to add a new style to me Is happening, because the paperclip tries to find the attachment with fingerprint and not one of the attachments.

Is there a way to add fingerprint to old attachments?

The error is that I have reprocessed old attachments:

  Erro :: Anoint: There is no such file or directory - / TMP / paperclrip-repris20140422-1036- nl9gxk < / Code>   

[edit] Have you tried? $ rake paperclip: refresh class = Model_Name_Goes_Here

[/ edit]

If you do not have too many images The simplest way, I can think:

  Dir.foreach ('/ path / to / dir / that / contains / old / images'). Items | Next if item == '.' Or item == '..' file = file.join (File.expand_path (File.dirname (__ FILE__)), item = thing.image = file thing.save end   

you Run this script using Runner:

  $ rails runner / path / to / script   

Is this something for you?

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -