Question

I am trying to include a module into my resque worker but I keep getting this error -

failed: #<NoMethodError: undefined method `build_page' for RefreshEventCache:Class>

The worker - /app/worker/refresh_event_cache.rb

require File.dirname(__FILE__) + '/../../lib/locomotive/render.rb'
class RefreshEventCache
  include Resque::Plugins::UniqueJob
  include Locomotive::Render

  @queue = :events_queue  

  def self.perform(url)  
    build_page(url)
  end  
end

The Module - /lib/locomotive/render.rb

module Locomotive
  module Render

    extend ActiveSupport::Concern

    module InstanceMethods

      def build_page(full_path)
        Rails.logger.debug "BUILDING PAGE"
      end
    end
  end
 end

Any ideas ?

Was it helpful?

Solution

Have you tried to add the extend ActiveSupport::Concern to the main module Locomotive like this:

module Locomotive
  extend ActiveSupport::Concern
  module Render

    module InstanceMethods

      def build_page(full_path)
        Rails.logger.debug "BUILDING PAGE"
      end
    end
  end
 end

Just guessing,... Ive used the extension with single modules but this seems to be logical for me.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top