bug fix jobs controller

This commit is contained in:
Judy Ngai 2016-04-13 12:24:29 -04:00
parent 35bbd2a492
commit 2c412ce56f

View file

@ -16,10 +16,10 @@ class JobsController < ApplicationController
respond_to do |format|
if !running? && @job.destroy
format.html { redirect_to jobs_path, notice: "Job deleted." }
format.json { render json: "", status: :ok }
format.json { head :no_content }
else
format.html { redirect_to jobs_path, alert: 'Can not delete a running job.' }
format.json { render json: "", status: :unprocessable_entity }
format.json { render json: @job.errors, status: :unprocessable_entity }
end
end
end
@ -34,7 +34,7 @@ class JobsController < ApplicationController
format.json { render json: @job, status: :ok }
else
format.html { redirect_to jobs_path, alert: 'Can not enqueue a running job.' }
format.json { render json: "", status: :unprocessable_entity }
format.json { render json: @job.errors, status: :unprocessable_entity }
end
end
end
@ -53,7 +53,7 @@ class JobsController < ApplicationController
respond_to do |format|
format.html { redirect_to jobs_path, notice: "Failed jobs removed." }
format.json { render json: '', status: :ok }
format.json { head :no_content }
end
end
@ -62,7 +62,7 @@ class JobsController < ApplicationController
respond_to do |format|
format.html { redirect_to jobs_path, notice: "All jobs removed." }
format.json { render json: '', status: :ok }
format.json { head :no_content }
end
end