No commit activity in last 3 years
No release in over 3 years
An Active Record model can be defined as 'queueable'. That adds extensions to add any method to the queue that exists on the method instance.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Resque Queueable¶ ↑

Overview¶ ↑

This gem extends ActiveRecord and Resque to add an automatic queue to any persisted model. Simply mark the model as ‘queueable’ and then call methods on the queue.

Assumption is that you have a working knowledge of Resque, because it is awesome:

github.com/defunkt/resque

To get it, just drop in the gem and you’re good to go:

gem 'resque-queueable', :git => "http://github.com/kmcphillips/resque-queueable"

Example Usage¶ ↑

The following is the old boring way:

class Pie < ActiveRecord::Base
  def describe(adj)
    "This pie is #{adj}"
  end

  def async_describe(adj)
    Resque.enque(self.class, self.id, :describe, adj)
  end

  def self.perform(id, method, *args)
    self.find(id).send(method, args)
  end
end

Pie.last.async_describe "delicious"

It can be replaced with:

class Pie < ActiveRecord::Base
  resqueable :queue_name

  def describe(adj)
    "This pie is #{adj}"
  end
end

Pie.last.queue.describe "delicious"

Shiny.

The Usual¶ ↑

Author: Kevin McPhillips - github@kevinmcphillips.ca