4
votes

I have followed instructions on sidekiq delayed extensions as per: https://github.com/mperham/sidekiq/wiki/Delayed-Extensions

Using sidekiq version 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: "[email protected]"

  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 => "[email protected]", subject: @title)
  end
end

For some reason I'm getting an undefined class/module error:

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'

My sidekiq queue looks like this:

Queue: default

Worker: Sidekiq::Extensions::DelayedMailer

Arguments: "---\n- !ruby/class 'ContactMailer'\n- :email_support\n- - afadf\n - ''\n - ''\n - ''\n - afdadf...

1
It seems like it works in staging but not development. github.com/mperham/sidekiq/issues/1043 – sunnyto
I’ve also had issues with this in development. I used the same instructions and class hierarchy. I never found a solution. – parhamr
can you plz give detailed code. so that we can found issue what you are getting. – KKB

1 Answers

1
votes