Sha256: f60ad4d4976fdb625e4ea89f2f90d5b7e6b2b80ea075a1b5bc40e5b08aae9ea2

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

require_dependency 'tasuku/application_controller'

module Tasuku
  class Taskables::Code::ResponsesController < ApplicationController
    include Concerns::Redirectable

    before_action :set_request

    def create
      response = @request.responses.new response_params
      response.author = send Tasks.config.author

      respond_to do |format|
        if response.save
          format.html { redirect_to redirect_path_for(response) }
        else
          format.html { redirect_to :back, alert: response.errors.full_messages.to_sentence }
        end
      end
    end

    private

    def response_params
      params.require(:taskables_code_response).permit(:code)
    end

    def set_request
      @request = Taskables::Code::Request.find params[:request_id]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tasuku-1.1.0 app/controllers/tasuku/taskables/code/responses_controller.rb
tasuku-1.0.1 app/controllers/tasuku/taskables/code/responses_controller.rb