Sha256: 62874e2f28813fadd257d8d2a100f633f62a13c4c230eece4a96b988f9768392

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

require_dependency 'tasuku/application_controller'

module Tasuku
  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

4 entries across 4 versions & 1 rubygems

Version Path
tasuku-1.1.0 app/controllers/tasuku/taskables/text/responses_controller.rb
tasuku-1.0.1 app/controllers/tasuku/taskables/text/responses_controller.rb
tasuku-0.1.1 app/controllers/tasuku/taskables/text/responses_controller.rb
tasuku-0.1.0 app/controllers/tasuku/taskables/text/responses_controller.rb