我已按照有关 sidekiq 延迟扩展的说明进行操作:https ://github.com/mperham/sidekiq/wiki/Delayed-Extensions
使用 sidekiq 版本 2.14.1
class ContactController < ApplicationController
def create
contact = params[:contact]
ContactMailer.delay.email_support(contact[:name], contact[:email], contact[:phone], contact[:category], contact[:details])
redirect_to contact_path, notice: t("contact.email_support.sent_confirmation_flash")
end
end
#/app/mailers/contact_mailer.rb
class ContactMailer < ActionMailer::Base
default from: "test@test.com"
def email_support(name, email, phone, category, details)
@name = name
@email = email
@phone = phone
@category = category
@details = details
@title = "#{t('contact.email_support.title')} - #{@category}"
mail(:to => "support@test.com", subject: @title)
end
end
出于某种原因,我收到未定义的类/模块错误:
2013-09-13T16:39:57Z 73620 TID-ov93oo7a8 WARN: undefined class/module ContactMailer
2013-09-13T16:39:57Z 73620 TID-ov93oo7a8 WARN: /Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:334:in `path2class'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:334:in `resolve_class'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:71:in `deserialize'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:104:in `visit_Psych_Nodes_Scalar'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:259:in `block in register_empty'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:259:in `each'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:259:in `register_empty'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:122:in `visit_Psych_Nodes_Sequence'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:240:in `visit_Psych_Nodes_Document'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:15:in `visit'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/visitor.rb:5:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/visitors/to_ruby.rb:20:in `accept'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych/nodes/node.rb:35:in `to_ruby'
/Users/sunnyto/.rbenv/versions/2.0.0-p0/lib/ruby/2.0.0/psych.rb:130:in `load'
我的 sidekiq 队列如下所示:
队列:默认
工人:Sidekiq::Extensions::DelayedMailer
参数:“---\n- !ruby/class 'ContactMailer'\n- :email_support\n- - afadf\n - ''\n - ''\n - ''\n - afdadf...