Sha256: 6292d15a770ce700e87e703eb909ec68cd0a4985a85f5e038fd0e39e60b1d8ec

Contents?: true

Size: 616 Bytes

Versions: 3

Compression:

Stored size: 616 Bytes

Contents

#encoding: utf-8

module Flyboy
  class TaskCommentsController < ::Flyboy::ApplicationController
    def create
      @task    ||= Task.find(params[:task_id])
      @comment ||= @task.comments.new(task_comment_params)

      @comment.date = DateTime.now # TODO : Export to model ?

      authorize! :update, @task

      if @comment.save
        redirect_to @task
      else
        render "flyboy/tasks/show"
      end
    end

    private

    def permitted_params
      [:progress, :description]
    end

    def task_comment_params
      params.require(:task_comment).permit(permitted_params)
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flyboy-0.0.5 app/controllers/flyboy/task_comments_controller.rb
flyboy-0.0.4 app/controllers/flyboy/task_comments_controller.rb
flyboy-0.0.3 app/controllers/flyboy/task_comments_controller.rb