从Ruby 2.1.2升级到Ruby 2.1.5后,使用delayed_mailhopper发送电子邮件会产生此错误:
ArgumentError: wrong number of arguments (1 for 0)
…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb: 9:in `initialize'
…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb: 9:in `new'
…ailhopper-0.0.7/app/models/delayed_mailhopper/email.rb: 9:in `enqueue'
…0/gems/mailhopper-0.3.0/app/models/mailhopper/email.rb: 25:in `create_from_mail'
…by/2.1.0/gems/mailhopper-0.3.0/lib/mailhopper/queue.rb: 7:in `deliver!'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb: 232:in `block in deliver'
…/bundle/ruby/2.1.0/gems/mail-2.5.4/lib/mail/message.rb: 232:in `deliver'
…ms/delayed_job-4.0.0/lib/delayed/performable_mailer.rb: 6:in `perform'
…1.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb: 105:in `block in invoke_job'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 38:in `run_callbacks'
…1.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb: 102:in `invoke_job'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 206:in `block (2 levels) in run'
/usr/local/lib/ruby/2.1.0/timeout.rb: 91:in `block in timeout'
/usr/local/lib/ruby/2.1.0/timeout.rb: 101:in `call'
/usr/local/lib/ruby/2.1.0/timeout.rb: 101:in `timeout'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 206:in `block in run'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 205:in `run'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 267:in `block in reserve_and_run_one_job'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 267:in `reserve_and_run_one_job'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 189:in `block in work_off'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 188:in `times'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 188:in `work_off'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 153:in `block (4 levels) in start'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 152:in `block (3 levels) in start'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 151:in `block (2 levels) in start'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 150:in `loop'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 150:in `block in start'
…s/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb: 7:in `call'
…s/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb: 7:in `block (2 levels) in <class:ClearLocks>'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 78:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 78:in `block (2 levels) in add'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 60:in `block in initialize'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 78:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 78:in `block in add'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `call'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 65:in `execute'
…/2.1.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb: 38:in `run_callbacks'
…uby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb: 149:in `start'
…ruby/2.1.0/gems/delayed_job-4.0.0/lib/delayed/tasks.rb: 9:in `block (2 levels) in <top (required)>'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 240:in `call'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 240:in `block in execute'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 235:in `each'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 235:in `execute'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 179:in `block in invoke_with_call_chain'
/usr/local/lib/ruby/2.1.0/monitor.rb: 211:in `mon_synchronize'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 172:in `invoke_with_call_chain'
…ed/bundle/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb: 165:in `invoke'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 150:in `invoke_task'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `block (2 levels) in top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `each'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 106:in `block in top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 115:in `run_with_threads'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 100:in `top_level'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 78:in `block in run'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 176:in `standard_exception_handling'
…le/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb: 75:in `run'
我已将其缩小到这行代码Delayed::Job.enqueue(SendJob.new(self.id))
(view code)并且我尝试将Delayed::Job.enqueue(SendJob.new(1))
和SendJob.new(1)
粘贴到rails中控制台,我得到同样的错误:
ArgumentError: wrong number of arguments (1 for 0)
from (irb):14:in `initialize'
from (irb):14:in `new'
from (irb):14
from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:47:in `start'
from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:8:in `start'
from /var/.../web_head/shared/bundle/ruby/2.1.0/gems/railties-3.2.21/lib/rails/commands.rb:41:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我为两个Ruby环境运行Rails 2.3.21。它仍然适用于较旧的Ruby 2.1.2环境。有什么想法吗?