「:未定義のメソッド `perform` NoMethodErrorを」Resque労働者が出ています
-
26-09-2019 - |
質問
私は、私がここで行われているが、私はその後、作業員が接続すると、重い物を持ち上げる(IEの比較、データベースエントリを)しResque、上に仕事をキューにRailsの中で、一方のコントローラを取得しようとしているものは考えています。< BR> しかし、タスクも実行されていない、Resqueを設定するための明確な指示がないので。
をコピーし、以下の貼ります。
!の
これはHoptoadから例外ラインがあります:
NoMethodError: undefined method 'perform' for Violateq:Module
これは、「労働者」のファイルの内容です
module Violateq
@queue = :violateq
def perform(nick, rulenumber)
# Working for the weekend!!!
puts "I got a nick of #{nick} and they broke #{rulenumber}"
@violation = Violation.new(nick, rulenumber)
puts "If you got this far, your OK"
log_in(:worker_log, {:action => "Violate d=perfom", :nick => nick, :rulenumber => rulenumber, :status => "success"})
#rescue => ex
# notify_hoptoad(ex)
# log_in(:worker_log, {:action => "Violate d=perfom", :nick => nick, :rulenumber => rulenumber, :status => "failure"})
end
end
これは、「web_controller」ファイルの内容です
class IncomingController < ApplicationController
require 'mail'
skip_before_filter :verify_authenticity_token
def create
message = Mail.new(params[:message])
# Push the message into the queue
Resque.enqueue(Violateq, message.from.to_s, message.subject.to_s)
log_in(:endpoint_log, {:action => "IncomingController d=create", :subject => message.subject, :message => message.body.decoded})
render :text => 'success', :status => 200 # a status of 404 would reject the mail
rescue => ex
notify_hoptoad(ex)
render :text => 'failure', :status => 500
end
end
お時間をありがとうございました、そしてあなたが任意のより多くの情報をご希望の場合は、私に連絡することを躊躇しないでください、
ルーク・カーペンター
解決
固定。
変更def perform
にdef self.perform
そして、それは働いていた。
おかげで、
ルーク・カーペンター
所属していません StackOverflow