I am having problems calling methods from an included module inside a work resource. In the example below, I continue to get undefined method errors when I try to call the say method inside the worker (which is in the TestLib module). I have illustrated this code to a simple basis:
controller (/app/controllers/test_controller.rb)
class TestController < ApplicationController def testque Resque.enqueue( TestWorker, "HI" ) end end
Library (/lib/test_lib.rb)
module TestLib def say( word ) puts word end end
employee (/workers/test_worker.rb)
require 'test_lib' class TestWorker include TestLib @queue = :test_queue def self.perform( word ) say( word )
Rakefile (Resque.rake)
require "resque/tasks" task "resque:setup" => :environment
I run resque using the following command: rake environment resque:work QUEUE='*'
Gemstones: rails (3.0.4) redis (2.2.2) redis-namespace (1.0.3) resque (1.19.0)
Server: nginx / 1.0.6
Anyone have any ideas on what is going on there?
ruby-on-rails resque worker
internetoutfitters
source share