Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (33 sloc) 1.95 KB


Mongoid::PaperclipQueue is a complete rewrite of Delayed_Paperclip and Mongoid_Paperclip to allow those of us using Mongoid to process Paperclip attachments in the background using Resque.


We all know how important it is to keep our page load times down, so this allows us to dump all that processing to Resque to perform in the background.


Install the gem:

sudo gem install mongoid_paperclip_queue

Or for Rails 3, to your Gemfile:

gem "mongoid_paperclip_queue", "~> 0.1.1"


  • Mongoid
  • Paperclip
  • Resque

You don’t need to include paperclip in your Gemfile.


In your model:

  class User 
    extend Mongoid::PaperclipQueue

    has_queued_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }


Paperclip will behave exactly like they describe.


Make sure that you have Resque up and running. The jobs will be dispatched to the :paperclip queue, so you can correctly dispatch your worker. Configure resque and your workers exactly as you would otherwise.

Detect the processing state

Processing? detection is built in. We take advantage of Redis since it should already be running, and we can keep our #{attachment_name}_processing field out of our MongoDB and into a more temporary key store. The temporary image url isn’t saved anywhere, so you’ll have to specify that on your own, but it’s easy to use:

  @user = User.find(1)
  url = @user.avatar.processing? ? "/images/missing.png" : @user.avatar.url


Checkout out CONTRIBUTING for more info.

Jump to Line
Something went wrong with that request. Please try again.