今天我发现了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'
我使用所有这些宝石,但用途不同。
目前我有两名工人:一名使用" sidekiq" +" sidekiq-cron"和另一个(我认为你有一个很好的猜测)使用" sidekiq" +" sidekiq_mailer"。
我有一个 PersonMailer ,但是这并没有使用" sidekiq_mailer"又:
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。