Rails Resque - включая модуль от Rails Lib в рабочем

StackOverflow https://stackoverflow.com/questions/7835027

  •  27-10-2019
  •  | 
  •  

Вопрос

Я пытаюсь включить модуль в своего резакционера, но я продолжаю получать эту ошибку -

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

Работник - /papp/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

Модуль - /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

Любые идеи ?

Это было полезно?

Решение

Пробовали ли вы добавить расширение ActiveSupport :: забота о основном локомотиве, как это:

module Locomotive
  extend ActiveSupport::Concern
  module Render

    module InstanceMethods

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

Просто угадая, ... Я использовал расширение с отдельными модулями, но это кажется логичным для меня.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top