Sha256: 61f92e847156fbdc1aa4a6ae0c33a120ee125447792c28768e09401234f45720

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

require_dependency "tasks/application_controller"

module Tasks
  class Taskables::Text::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_text_response).permit(:text)
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tasuku-0.0.1 app/controllers/tasks/taskables/text/responses_controller.rb