Skip to content


Subversion checkout URL

You can clone with
Download ZIP

Tips and Tricks

trevorturk edited this page · 1 revision


The killer feature that delayed_job has is send_later, this lets you transparently turn a method call on a class or object into a delayed_job. For example:

@photo.calculate_thumbnails # runs during your request
@photo.send_later(:calculate_thumbnails) # runs in a worker at some later stage

It also supports declaring certain methods to be handled asynchronously in an environment file:

# production.rb
config.after_initialize do
  Photo.handle_asynchronously :calculate_thumbnails

By making use of handle_asynchronously you can mark all the suitable callbacks to fire asynchronously without having to change any of your controllers. Just add an after_initialize block to your production environment and mark them for async handling.

Something went wrong with that request. Please try again.