Sha256: d54dc2264b4d98fb862abf2ba9cc72398ea7960bb3478d2c45b7dc3187d70619

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

class TasksController < ApplicationController
  skip_before_action :verify_authenticity_token
  before_action :load_section
  after_action :reset_queue, only: [:create, :update, :destroy]

  def index
    @tasks = Task.all
  end

  def new
    @task = Task.new
  end

  def edit
    @task = Task.find(params[:id])
  end

  def create
    @task = Task.create(task_params)
    redirect_to action: :index
  end

  def update
    @task = Task.find(params[:id])
    @task.update_attributes(task_params)
    redirect_to action: :index
  end

  def destroy
    @task = Task.find(params[:id])
    @task.destroy
    redirect_to action: :index
  end

  private
  def load_section
    @section = 'tasks'
  end

  def task_params
    params.require(:task).permit(:name, :type, :trigger, :database, :every, :status)
  end

  def reset_queue
    @task.reset_queue
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
redis_monitor-0.3.3 lib/engine/app/controllers/tasks_controller.rb
redis_monitor-0.3.2 lib/engine/app/controllers/tasks_controller.rb
redis_monitor-0.3 lib/engine/app/controllers/tasks_controller.rb