Sha256: d84ca59918c9b725c161cd8e7849e8a27669b524bf2d1bf87185cfbec5f7bb89
Contents?: true
Size: 1.46 KB
Versions: 1
Compression:
Stored size: 1.46 KB
Contents
require_dependency "tasks_management/application_controller" module TasksManagement class TasksController < ApplicationController before_action :set_task, only: [:show, :edit, :update, :destroy] # GET /tasks def index @tasks = Task.all 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['task']['priority'] = params['task']['priority'].to_i params['task']['state'] = params['task']['state'].to_i params.require(:task).permit(:title, :description, :priority, :state, :parent_id, :owner_id, :requester_id, :end_date, :document) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tasks_management-0.1.4 | app/controllers/tasks_management/tasks_controller.rb |