简体   繁体   中英

delayed_jobs not creating rows in delayed_jobs table

In may rails application i wanted to use delayed job. SO i installed delayed jobs as follows.

in gemfile

 gem 'delayed_job_active_record', '0.4.3'

then in console

 rails generate delayed_job:active_record

 rake db:create

It had created delayed_jobs table in database.

And i started

 rake jobs:work

Then i added the following code in controller:

 Task.handle_asynchronously :in_the_future, :run_at => Proc.new { 5.minutes.from_now }

here Task is the model name.

And in the model task.rb i wrote

 def in_the_future
   self.update_attiributes(:status=> "updated")
 end

After running controller method it's not creating any record in the delayed_jobs table. Please correct me if i am doing anything wrong.

您可以将控制器代码更改为

Task.delay(:run_at => Proc.new { 5.minutes.from_now }).in_the_future

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM