Sha256: 5d68941310d0f4469f02cf0bd03dda0f53dd075eb2e1da7c710e5fd895542a37

Contents?: true

Size: 626 Bytes

Versions: 3

Compression:

Stored size: 626 Bytes

Contents

module Adhoq
  class ExecutionsController < Adhoq::ApplicationController
    def show
      @execution = current_query.executions.where(id: params[:id], report_format: params[:format]).first!

      respond_report(@execution.report)
    end

    def create
      @execution = current_query.execute!(params[:execution][:report_format])

      redirect_to current_query
    end

    private

    def current_query
      @query ||= Adhoq::Query.find(params[:query_id])
    end

    def respond_report(report)
      send_data report.data, type: report.mime_type, filename: report.name, disposition: 'attachment'
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhoq-0.0.5 app/controllers/adhoq/executions_controller.rb
adhoq-0.0.4 app/controllers/adhoq/executions_controller.rb
adhoq-0.0.3 app/controllers/adhoq/executions_controller.rb