summaryrefslogtreecommitdiff
path: root/app/controllers/admin/jobs_controller.rb
blob: 659fa38889d10aeaa680ddcb1dd9ecabf7ae99dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Admin
  class JobsController < AdminController
    def initialize(repository = Delayed::Job)
      @repository = repository
      super()
    end

    def index
      @jobs = @repository.order(created_at: :desc)
    end

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

    def update
      @job = @repository.find(params[:id])
      @job.invoke_job
      redirect_to admin_jobs_path
    end

    def destroy
      @job = @repository.find(params[:id])
      @job.destroy
      redirect_to admin_jobs_path
    end
  end
end