2
我想要延遲工作來作爲耙工作,但對於我的生活,我無法弄清楚我做錯了什麼。鑑於以下設置:延遲作業耙任務失敗
#config/environment.rb
Rails::Initializer.run do |config|
config.gem 'delayed_job'
end
#Rakefile
begin
require 'delayed/tasks'
rescue LoadError
STDERR.puts "Run `rake gems:install` to install delayed_job"
end
#Observer
class SomeObserver < ActiveRecord::Observer
def foo(bar)
end
handle_asynchronously :foo
end
每當我運行rake作業:清楚,我收到以下錯誤:
undefined method `handle_asynchronously' for SomeObserver:Class
即使當我跑步時的測試情況下,我沒有得到這個錯誤或它直接。有任何想法嗎?