summaryrefslogtreecommitdiff
path: root/app/controllers/task_lists_controller.rb
blob: cbd23073def5b1b4235b4a72e56eed5cfbccf078 (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
29
30
31
32
33
34
35
36
37
class TaskListsController < ApplicationController
  before_action :set_task_list, only: [:show, :edit, :update]

  def index
    @task_lists = TaskList.all
  end

  def show
    @task = Task.new
  end

  def new
    @task_list = TaskList.new
  end

  def edit
  end

  def update
    @task_list.update!(params[:task_list])
  end

  def create
    task_list = TaskList.create!(task_list_params)
    redirect_to task_list_path(task_list)
  end

  private

  def task_list_params
    params.require(:task_list).permit(:name)
  end

  def set_task_list
    @task_list = TaskList.find(params[:id])
  end
end