views:

244

answers:

2

I have over time, changed the size for thumbs of the class Deal. Through these changes, users were uploading to the site, so there are few people who have different sized thumbs. I wanted to reprocress or refresh these, so I went to into my root and typed:

$> rake paperclip:refresh class=Deal

Did nothing for the thumb sizes.. Then I in script/console :

Deal.find(987).reprocess!

Returned this :

NoMethodError: undefined method `reprocess!' for #<Deal:0xb68a0988>
from /data/HQ_Channel/releases/20100607130346/vendor/rails/activerecord/lib/active_record/attribute_methods.rb:260:in `method_missing'
from (irb):7

My deal class is this :

=> Deal(id: integer, organization_id: integer, deal: string, value: string, what: string, description: string, image_file_name: string, image_content_type: string, image_file_size: integer, image_updated_at: datetime, created_at: datetime, updated_at: datetime, deal_image_file_name: string, deal_image_content_type: string, deal_image_file_size: integer, deal_image_uploaded_at: datetime)

What can i do to have it reprocess the original to make the thumb the correct size in the current thumb size params?

UPDATE:

I have found the attachment.rb included with paperclip. What's interesting is that methods like .save, and .updated_at work. But reprocess! and a few other methods do not. Does anything smell obviously out of place?

A: 

You need to run the reprocess! through script/console instead of irb.

Navigate to the root of your rails app and run

script/console production 

and then run your

Deal.find(987).reprocess!
Mike Buckbee
Sorry, that's what I did, not IRB. I updated it above. And it returned the reprocess error
Trip
What version of Paperclip are you using?
Mike Buckbee
2.3.1 . Take note, I also added just an inch of more evidence above ( finding the attachment.rb, finding the methods in it. But not all the methods work.) Could it be..that the class Deal is not connected with paperclip? How can i find what classes *are* attached to paperclip?
Trip
In the Deal Model you should have a line that says has_attached_file() with a bunch of specifications for where the image is to be saved, etc.
Mike Buckbee
has_attached_file :deal_image, :styles => {:thumb => ["64x56#", :png], :full => ["#{SEARCH_IMAGE_WIDTH}x#{SEARCH_IMAGE_HEIGHT}#", :png] }, :convert_options => {:full => Proc.new{self.convert_options_full}, :thumb => Proc.new{self.convert_options}}<br /><br />So it's definately connected. Heck! It does save and resize. Just not all the attachment.rb methods work.
Trip
+2  A: 

Got it!

It's because paperclip is relevant to the Model's object, but rather the Model's object's image. So written proper, it would work like this :

Model.find(#).image.reprocess!
Trip