Sha256: d6e5e37a26271504798b272e78f073ae16d95c8c9a785b20b33703209af58f52

Contents?: true

Size: 1.3 KB

Versions: 5

Compression:

Stored size: 1.3 KB

Contents

require_dependency "integration_pal/application_controller"

module IntegrationPal
  class TasksController < ApplicationController
    before_action :set_task, only: [:show, :edit, :update, :destroy]

    # GET /tasks
    def index
      @tasks = Job.find(params[:job_id]).tasks.order('created_at DESC')
    end

    # GET /tasks/1
    def show
    end

    # GET /tasks/new
    def new
      @task = Task.new
    end

    # GET /tasks/1/edit
    def edit
    end

    # POST /tasks
    def create
      @task = Task.new(task_params)

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

    # PATCH/PUT /tasks/1
    def update
      if @task.update(task_params)
        redirect_to @task, notice: 'Task was successfully updated.'
      else
        render :edit
      end
    end

    # DELETE /tasks/1
    def destroy
      @task.destroy
      redirect_to tasks_url, notice: 'Task was successfully destroyed.'
    end

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

      # Only allow a trusted parameter "white list" through.
      def task_params
        params.require(:task).permit(:status, :progress, :job_id)
      end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
integration_pal-0.2.3 app/controllers/integration_pal/tasks_controller.rb
integration_pal-0.2.2 app/controllers/integration_pal/tasks_controller.rb
integration_pal-0.2.1 app/controllers/integration_pal/tasks_controller.rb
integration_pal-0.2.0 app/controllers/integration_pal/tasks_controller.rb
integration_pal-0.1.6 app/controllers/integration_pal/tasks_controller.rb