Sha256: 34fa86264c52872a44e038c5218abd9ac4bfa321bc2a4793d76a7f0abae2f4a1

Contents?: true

Size: 798 Bytes

Versions: 4

Compression:

Stored size: 798 Bytes

Contents

require_dependency 'tasuku/application_controller'

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

4 entries across 4 versions & 1 rubygems

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