iron_worker:Rails中活动记录类的未初始化常量错误

时间:2011-12-27 10:42:58

标签: ruby-on-rails activerecord worker ironworker

我正在测试铁工人(曾经是简单的工人),它无法识别Heroku上我的Rails应用程序中的活动记录类名称。您可以在下面找到“AdImpression”,即类名。

铁工人支持网站上的文档说我可以自由使用活动记录对象但不知何故对我来说并非如此。

有什么想法吗?

/mnt/sw_jobs/u17501/user_dir/daily_ad_campaign_counter_worker.rb:56:in `insert_data_on_specific_date': uninitialized constant DailyAdCampaignCounterWorker::AdImpression (NameError)
    from /mnt/sw_jobs/u17501/user_dir/daily_ad_campaign_counter_worker.rb:13:in `run'
    from /mnt/sw_jobs/u17501/user_dir/runner.rb:337:in `<main>'
job_data={"class_name"=>"DailyAdCampaignCounterWorker", "attr_encoded"=>"e30=\n", "file_name"=>"daily_ad_campaign_counter_worker.rb", "rails"=>{"env"=>"development", "version"=>"3.1.1"}, "sw_config"=>{"token"=>"Yd8Q6Nyobw2Ms7UQ93ZpNCcKUX4", "project_id"=>"4ef49d8acea6fe6ea30007ef", "database"=>{"adapter"=>"mysql2", "username"=>"XXXXXX", "port"=>3306, "host"=>"XXXXxx", "password"=>"aXXXXX", "database"=>"XXXXXX"}, "global_attributes"=>{}}}
I, [2011-12-27T10:36:30.980685 #11059]  INFO -- : IronWorker initialized.
Starting DailyAdCampaignCounterWorker 2011-12-27 10:36:30 +0000

1 个答案:

答案 0 :(得分:1)

我找到了自己问题的答案。事实证明,您必须合并运行脚本所需的模型,因为Iron worker已更改其默认设置。