RailsCasts Pro episodes are now free!
Learn more or hide this
Note: What I stated in the episode about job priority is incorrect. A priority of "0" is top priority and will be processed before a priority of 10 or some higher number.
rails g delayed_job:active_record
Newsletter.delay(queue: "newsletter", priority: 20, run_at: 5.minutes.from_now).deliver(params[:id])
Delayed::Worker.max_attempts = 5
Delayed::Worker.delay_jobs = !Rails.env.test?