#encoding: utf-8 module Flyboy class TaskCommentsController < ::Flyboy::ApplicationController before_action :set_objects def create @task = Task.find(params[:task_id]) authorize! :comment, @task @comment = @task.comments.new(task_comment_params) @comment.date = DateTime.now # TODO : Export to model ? if @comment.save redirect_to @task else render "flyboy/tasks/show" end end private def set_objects @task = Task.find params[:task_id] end def permitted_params [:progress, :description] end def task_comment_params params.require(:task_comment).permit(permitted_params) end end end