collectiveidea / delayed_job

Database based asynchronous priority queue system -- Extracted from Shopify
http://groups.google.com/group/delayed_job
MIT License
4.81k stars 956 forks source link

.delay doesn't work #89

Closed rurounijones closed 14 years ago

rurounijones commented 14 years ago

I have tried to use .delay in both ActiveRecord model class methods and in methods of instances of said class but I keep getting the following errors:

undefined method `delay' for #<Class:0xb537dd58>
undefined method `delay' for #<Order:0xb530c84c>

The only way I can us D_J right now is using the handle_asynchronously option but I need to be able to disable that for testing hence needing to use .delay instead.

I am assuming there must be something wrong with my setup because no one else has reported this. I am using config.gem "delayed_job". Not the plugin

Ruby 1.8.7 Rails 2.3.5 Delayed_job 2.0.3

rurounijones commented 14 years ago

I have included my installed gems just in case (from main environment.rb)

config.gem 'haml' # HAML Template Language
config.gem 'will_paginate' # Allows us to retrieve records in batches
config.gem 'jrails' # Add jQuery support
config.gem 'devise', :version => "1.0.6" # Authentication System
config.gem "cancan" # Authorization system
config.gem "paperclip" # File upload management
config.gem "newrelic_rpm" # Application Performance Monitoring
config.gem "fastercsv" # CSV File reading
config.gem "aasm" # State Machine code
config.gem "delayed_job" # Allows us to delay processing for later
config.gem "awesome_nested_set" # Allows for set / tree structures
config.gem "savon" # SOAP Library needed for DSMO integration
config.gem "cobravsmongoose" # Has some useful XML to ruby hash functions
config.gem "bullet" # Database Query monitoring for development
chrisharper commented 14 years ago

The delay method was added in 2.1.0.pre. Try this in your Gemfile instead and all should work.

gem 'delayed_job', '2.1.0.pre'

rurounijones commented 14 years ago

Groovy, didn't realise this was a recent addition. Thank you very much. Will test when I get the chance