任何人都可以帮忙解决这个Delayed_Jobs错误吗?

问题描述

| 我的delay_job失败,出现一个奇怪的错误。我已经完成了所有步骤,但没有任何失败。我在测试服务器上运行此程序,没有任何失败。但是在生产中,某种数据正在摇摇欲坠。有任何想法吗?
Email(#-616792908) expected,got NilClass(#-605566518)\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_proxy.rb:263:in `raise_on_type_mismatch\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:117:in `<<\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:116:in `each\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:116:in `<<\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:141:in `transaction\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/transactions.rb:182:in `transaction\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:140:in `transaction\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/rails/activerecord/lib/active_record/associations/association_collection.rb:115:in `<<\'\\n/data/HQ_Channel2/releases/20110610192557/lib/magic_email.rb:11:in `perform\'\\n/data/HQ_Channel2/releases/20110610192557/lib/magic_email.rb:8:in `each\'\\n/data/HQ_Channel2/releases/20110610192557/lib/magic_email.rb:8:in `perform\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/backend/base.rb:53:in `invoke_job\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:108:in `run\'\\n/usr/lib/ruby/1.8/timeout.rb:67:in `timeout\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:108:in `run\'\\n/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:107:in `run\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:162:in `reserve_and_run_one_job\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:92:in `work_off\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:91:in `times\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:91:in `work_off\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:66:in `start\'\\n/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:65:in `start\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:62:in `loop\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/worker.rb:62:in `start\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/command.rb:69:in `run\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/command.rb:46:in `daemonize\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `call\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/application.rb:215:in `start_proc\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/daemonize.rb:192:in `call\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/daemonize.rb:192:in `call_as_daemon\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/application.rb:219:in `start_proc\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/application.rb:255:in `start\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/controller.rb:69:in `run\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons.rb:188:in `run_proc\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `call\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons/cmdline.rb:105:in `catch_exceptions\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/gems/daemons-1.0.10/lib/daemons.rb:187:in `run_proc\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/command.rb:45:in `daemonize\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/command.rb:43:in `times\'\\n/data/HQ_Channel2/releases/20110610192557/vendor/plugins/delayed_job/lib/delayed/command.rb:43:in `daemonize\'\\nscript
假设这是一个关联问题,这是我的HABTM的一些背景知识。
class Email < ActiveRecord::Base
  has_and_belongs_to_many :card_signups
end

class CardSignup < ActiveRecord::Base
  has_and_belongs_to_many :emails
end
    

解决方法

        好的,所以我以一种奇怪的方式解决了这种情况,并且我非常乐于向某人解释为什么能够解决这个问题,但这就是我以前遇到的事情:
CardSignup.find_by_email(email).emails << orig_email
这是导致错误的原因。这是固定的原因:
CardSignup.find_by_email(email).emails << Email.find(orig_email.id)
由于某些原因,Delayed_Jobs无法对原始对象进行查询?     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...