How we can check job is failed?

nathancolgate edited this page Oct 27, 2011 · 2 revisions

Q: I want to check which job got failed. how can i get details of failed job?

A: I have a controller in my admin area that allows me to browse delayed jobs:


class Admin::DelayedJobsController < ApplicationController
  def index
    @jobs = Delayed::Job.all

    respond_to do |format|
      format.html # index.html.erb
    end  
  end
  
  def show
    begin
      @job = Delayed::Job.find(params[:id])
    rescue
      redirect_to [:admin,:delayed_jobs], :notice => 'That specific job has finished processing'
    end
  end

  def destroy
    @job = Delayed::Job.find(params[:id])
    @job.destroy
    
    respond_to do |format|
      format.html {redirect_to(admin_delayed_jobs_path, :notice => 'Job destroyed')}
    end
  end


end