Sha256: d5c76bbbe059cab89e7f26ccb6e43c0d8f6a738e0ddba2b62893a48290be1033

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require_dependency "integration_pal/application_controller"

module IntegrationPal
  class JobsController < ApplicationController
    before_action :set_job, only: [:show, :edit, :update, :destroy]

    # GET /jobs
    def index
      @jobs = Job.all
    end

    # GET /jobs/1
    def show
    end

    # GET /jobs/new
    def new
      @job = Job.new
    end

    # GET /jobs/1/edit
    def edit
    end

    # POST /jobs
    def create
      @job = Job.new(job_params)

      if @job.save
        redirect_to @job, notice: 'Job was successfully created.'
      else
        render :new
      end
    end

    # PATCH/PUT /jobs/1
    def update
      if @job.update(job_params)
        redirect_to @job, notice: 'Job was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /jobs/1
    def destroy
      @job.destroy
      redirect_to jobs_url, notice: 'Job was successfully destroyed.'
    end

    private
      # Use callbacks to share common setup or constraints between actions.
      def set_job
        @job = Job.find(params[:id])
      end

      # Only allow a trusted parameter "white list" through.
      def job_params
        params.require(:job).permit(:status, :progress, :worker_id)
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
integration_pal-0.1.1 app/controllers/integration_pal/jobs_controller.rb
integration_pal-0.1.0 app/controllers/integration_pal/jobs_controller.rb