Sha256: 89122bad704c2303333e25548b79cf06a0e3e5c706e15d82b338456a50348aed

Contents?: true

Size: 788 Bytes

Versions: 1

Compression:

Stored size: 788 Bytes

Contents

require_dependency "tasks/application_controller"

module Tasks
  class Taskables::URL::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_url_response).permit(:url)
    end

    def set_request
      @request = Taskables::URL::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/url/responses_controller.rb