Search code examples
ruby-on-railsasynchronousundefinedsidekiq

undefined method when using Sidekiq's delayed_extensions


When using Sidekiq's delayed extensions, I get this error in my bundle exec sidekiq shell:

2013-03-06T04:13:57Z 52099 TID-ouqzj4xl8 WARN: undefined method `send_message' for #<Class:0x007f8a783d72f0>

In my controller:

MyClass.delay_until(10.seconds.from_now, :retry => true).send_message(deliver_sms, phone)

In my model:

require 'sidekiq'

class MyClass < ActiveRecord::Base

  include Sidekiq::Extensions

  def self.send_message(deliver_sms, phone)
    message_id = deliver_sms.deliver(phone, 'This is a test message') 
  end
end

Any help would be appreciated


Solution

  • It seems to be an issue with Ruby < 1.9.3 according to this thread on Github: https://github.com/mperham/sidekiq/issues/152#issuecomment-5281759

    I had the same issue and upgrading to Ruby 1.9.3 fixed it. Any chance you are using 1.9.2?