Sha256: de85f5e678422e8879971b450dae6ef582e008ff2f88ecfcc667450b9e12a777

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

require_dependency "tasks/application_controller"

module Tasks
  class Taskables::Image::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_image_response).permit(:image)
    end

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