actionmailer推迟了作业错误

我有一个奇怪的错误使用邮件和延迟工作与轨3和红宝石1.9.2。

我在邮件中有一个方法

def new_site_message(sitereq)
    @footer = Textvar.where(:title => "email_footer").first
    @sitereq = Sitereq.first
    mail(:to => EmailGroup.where(:name => "new_sitemessage_group").first.emails.map(&:email).join(", "), :subject => "Test")
end

它工作得很好,延迟工作无延迟。 但是当我延迟它 - 我得到错误(从delayed_jobs表,last_error):

{undefined method `ascii_only?' for #<Email:0xa67780c>
/opt/ruby/lib/ruby/gems/1.9.1/gems/activemodel-3.0.4/lib/active_model/attribute_methods.rb:364:in `method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/attribute_methods.rb:46:in `method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/encodings.rb:181:in `encode_non_usascii'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/encodings.rb:176:in `address_encode'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/encodings.rb:173:in `block in address_encode'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/associations/association_collection.rb:430:in `block in method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/associations/association_proxy.rb:216:in `block in method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/associations/association_proxy.rb:216:in `map'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/associations/association_proxy.rb:216:in `method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.0.4/lib/active_record/associations/association_collection.rb:430:in `method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/encodings.rb:173:in `address_encode'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/fields/common/common_address.rb:20:in `encode_if_needed'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/fields/common/common_address.rb:9:in `parse'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/fields/to_field.rb:42:in `initialize'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/field.rb:158:in `new'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/field.rb:158:in `new_field'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/field.rb:145:in `create_field'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/field.rb:78:in `initialize'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/header.rb:159:in `new'
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/header.rb:159:in `[]='
/opt/ruby/lib/ruby/gems/1.9.1/gems/mail-2.2.15/lib/mail/message.rb:1222:in `[]='
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:647:in `block in mail'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:647:in `each'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:647:in `mail'
/projects/smartspace/app/mailers/notice_mailer.rb:68:in `new_site_message'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.4/lib/abstract_controller/base.rb:150:in `process_action'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.4/lib/abstract_controller/base.rb:119:in `process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionpack-3.0.4/lib/abstract_controller/rendering.rb:41:in `process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/old_api.rb:75:in `process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:448:in `process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:443:in `initialize'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:427:in `new'
/opt/ruby/lib/ruby/gems/1.9.1/gems/actionmailer-3.0.4/lib/action_mailer/base.rb:427:in `method_missing'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/performable_mailer.rb:6:in `perform'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/backend/base.rb:87:in `invoke_job'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:120:in `block (2 levels) in run'
/opt/ruby/lib/ruby/1.9.1/timeout.rb:57:in `timeout'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:120:in `block in run'
/opt/ruby/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:119:in `run'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:177:in `reserve_and_run_one_job'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:104:in `block in work_off'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:103:in `times'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:103:in `work_off'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:78:in `block (2 levels) in start'
/opt/ruby/lib/ruby/1.9.1/benchmark.rb:309:in `realtime'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:77:in `block in start'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:74:in `loop'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/worker.rb:74:in `start'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:100:in `run'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:79:in `block in run_process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `call'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/application.rb:250:in `block in start_proc'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/daemonize.rb:199:in `call_as_daemon'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/application.rb:254:in `start_proc'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/application.rb:294:in `start'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/controller.rb:70:in `run'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons.rb:193:in `block in run_proc'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `call'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons/cmdline.rb:112:in `catch_exceptions'
/opt/ruby/lib/ruby/gems/1.9.1/gems/daemons-1.1.0/lib/daemons.rb:192:in `run_proc'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:78:in `run_process'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:72:in `block in daemonize'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:70:in `times'
/opt/ruby/lib/ruby/gems/1.9.1/gems/delayed_job-2.1.3/lib/delayed/command.rb:70:in `daemonize'
script/delayed_job:5:in `<main>' 

其他邮件程序方法在延迟作业中正常工作,只有这样才会出错。 我试图改变:以模拟字符串电子邮件,但没有响铃。

我该怎么做才能纠正这个错误?

链接地址: http://www.djcxy.com/p/65773.html

上一篇: actionmailer delayed job error

下一篇: Why does this clojure macro need `'~?