Home > delayed_paperclip

delayed_paperclip

Delayed_paperclip is a project mainly written in Ruby, based on the MIT license.

to ease the use of paperclip with delayed_job

h1. DelayedPaperclip

This plugin is for you if you want to load "Paperclip":http://github.com/thoughtbot/paperclip processing off to "Delayed_job":http://github.com/tobi/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_newjob method in your model.

Of course, installation of both "Paperclip":http://github.com/thoughtbot/paperclip and "Delayed_job":http://github.com/tobi/delayed_job/ is required, duh!

h2. Example


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 (c) 2009 Simon Baumgartner, released under the MIT license

Previous:pinger