Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Resque + ActiveRecord - Redis

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .document
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 swagger.gemspec
README.rdoc

Swagger = Resque + ActiveRecord - Redis

Swagger marries the power and robustness of Resque with the trivial setup of delayed_job. Swagger allows you to use all the features of Resque (github.com/defunkt/resque) without any of the “Redis” by adding one table to your existing database.

Getting Started

1. Add resque and swagger to your gem dependencies (order is important)

config.gem 'resque'
config.gem 'swagger'

2. In your rails app, create the file initializers/resque.rb with the following:

environment = ENV['RAILS_ENV'] || 'development'
database    = YAML::load(ERB.new(IO.read(File.join(File.dirname(__FILE__), '..', 'database.yml'))).result)[environment]

require 'swagger'
Resque.swagger!
Resque.connect_to_database(database)

NOTE: This allows rails and the resque admin app to use the same initializer by executing at the console: resque-web config/initializers/resque.rb

3. Create an active record migration

create_table :resque_values do |table|
  table.column :key,      :string
  table.column :key_type, :string
  table.column :score,    :integer
  table.column :value,    :text
  table.timestamps
end

add_index :resque_values, :key
add_index :resque_values, [:key, :key_type]

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don't break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright

Copyright © 2010 Matthew Deiters. See LICENSE for details.

Something went wrong with that request. Please try again.