未初始化的常量Sidekiq :: Worker(NameError)

时间:2014-08-18 18:06:59

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 actionmailer sidekiq

今天我发现了sidekiq-mailer,这是一个与Sidekiq集成的精彩宝石,真的可以帮助我的项目。但我在安装/配置方面遇到一些问题,有人可以帮助我吗?我已经看到了所有相关的问题而没有解决我的问题。

<小时/>

宝石文件

目前我使用最新版本的Sidekiq和最新版本的SidekiqMailer。您可以查看我的gemfile:

gem 'sidekiq'
gem "sidekiq-cron" 
gem 'sidekiq-failures' 
gem 'sidekiq_mailer', git: 'https://github.com/andersondias/sidekiq_mailer.git'

我使用所有这些宝石,但用途不同。


文件

目前我有两名工人:一名使用&#34; sidekiq&#34; +&#34; sidekiq-cron&#34;和另一个(我认为你有一个很好的猜测)使用&#34; sidekiq&#34; +&#34; sidekiq_mailer&#34;。

我有一个 PersonMailer ,但是这并没有使用&#34; sidekiq_mailer&#34;又:

class PersonMailer < ActionMailer::Base

  default from: "no-reply@myAwesomeProject.com"

  # Templates in "views/mailers/mailer_name/method_name.html.erb"
  default template_path: "mailers/#{self.name.underscore}"

  def send_email_new_user(user)
    @user = user
    mail(to: @user.email, subject: "You = <3")
  end

end

我这样打电话给我的邮件(在PersonController里面):

PersonMailer.send_email_new_user(user).deliver

<小时/>

错误

现在让我们谈谈我的错误。在终端中运行bundle install后,我无法启动本地主机服务器(rails s)。总是我尝试它我收到以下错误:

/home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/bundler/gems/sidekiq_mailer-4a5881b10c2a/lib/sidekiq_mailer/worker.rb:2:in `<class:Worker>': uninitialized constant Sidekiq::Worker (NameError)
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/bundler/gems/sidekiq_mailer-4a5881b10c2a/lib/sidekiq_mailer/worker.rb:1:in `<top (required)>'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/bundler/gems/sidekiq_mailer-4a5881b10c2a/lib/sidekiq_mailer.rb:2:in `<top (required)>'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `require'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `each'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:72:in `block in require'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `each'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler/runtime.rb:61:in `require'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/bundler-1.6.5/lib/bundler.rb:132:in `require'
    from /home/paladini/Documents/Programacao/myAwesomeProject/config/application.rb:6:in `<top (required)>'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/railties-3.2.3/lib/rails/commands.rb:53:in `require'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/railties-3.2.3/lib/rails/commands.rb:53:in `block in <top (required)>'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /home/paladini/.rvm/gems/ruby-1.9.3-p547@myAwesomeProject/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'


如何快速解决此问题?


P.S:我还将此问题发布为GitHub问题,here

0 个答案:

没有答案