Class: Admin::JobsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/admin/jobs_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



12
13
14
15
16
17
# File 'app/controllers/admin/jobs_controller.rb', line 12

def destroy
  if @job = Delayed::Job.find_by_id(params[:id])
    @job.destroy
  end
  redirect_to admin_jobs_path, :notice => "Job deleted"
end

#indexObject



4
5
6
# File 'app/controllers/admin/jobs_controller.rb', line 4

def index
  @jobs = Delayed::Job.order(:run_at)
end

#retryObject



19
20
21
22
23
24
25
# File 'app/controllers/admin/jobs_controller.rb', line 19

def retry
  if @job = Delayed::Job.find_by_id(params[:id])
    @job.update_column(:attempts, 0)
    @job.update_attributes(run_at: Time.now, failed_at: nil)
  end
  redirect_to admin_jobs_path, :notice => "Job will be retried"
end

#showObject



8
9
10
# File 'app/controllers/admin/jobs_controller.rb', line 8

def show
  @job = Delayed::Job.find(params[:id])
end