views:

101

answers:

1

I am try to perform the function:

rake paperclip:refresh class=foobar

And it begins to work, but it looks like it gets hung up with this stack.. :

** Invoke paperclip:refresh (first_time)
** Invoke paperclip:refresh:metadata (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute paperclip:refresh:metadata
rake aborted!
The specified key does not exist.

So I'm curious because I know some of the file extensions that are in this class are not there anymore. So I'm guessing that because it can't find one of them, it gives up on the whole process. Is there a way to say, skip over files if they do not exist ?

Or is this error from a bigger problem like, your whole s3 bucket cant be found by the paperclip:refresh task.

Update

So far, I've tried rake paperclip:clean class=foobar . It works, but didn't fix the problem

A: 

My supposition was accurate. The file listed in foobar's image attribute didn't match what was on the S3 so it bombs out for the entire task.

Instead I script/console'd and wrote this :

first_batch = Foobar.find(:all) { |f| f.id > 0 && f.id < 100 }

first_batch.select { |f| f.image.reprocess! if f.image.exists? }

I tried to do one big group change, but it ERRCONN's out. So I seperated them into batches by the 100. Have 430 records total. No worries.

Curious though if anyone has a more clever way to have done this. My seems kind of slow and tedious.

Trip