This plugin is for you if you want to load Paperclip processing off to Delayed_job
- stores uploaded file to the given directory
- enqueues an instance of the given Job class at the DJ job queue. Job instances are per default created with the object id only. If you need more you can overwrite the enqueue_new_job method in your model.
Of course, installation of both Paperclip and Delayed_job is required, duh!
class Post
has_attached_file :image
delay_paperclip :tmp_dir => "#{RAILS_ROOT}/tmp/images", :job_class => 'PostJob'
end
The Job Class should look like this:
class PostJob < Struct.new(:post_id)
def perform
Post.find(self.post_id).perform
end
end
Copyright © 2009 Simon Baumgartner, released under the MIT license