Sha256: 01b4ab5985b92b92cd142fd8d4ee6d7e4d48552f57855fa216031f945a467805

Contents?: true

Size: 654 Bytes

Versions: 16

Compression:

Stored size: 654 Bytes

Contents

class ResultCsvsController < ApplicationController
  respond_to :json
  before_filter :authorize_from_result, only: [:show]
  before_filter :log_download, only: [:show]

  def show
    respond_to do |format|
      format.json do
        url = CsvService.new(params[:id]).url
        if url
          render json: { url: url }
        else
          render nothing: true, status: 404
        end
      end
    end
  end

  private

  def authorize_from_result
    authorize! :read, Result.find(params[:id])
  end

  def log_download
    Rails.logger.info("Result CSV download requested for result #{params[:id]} by user_id #{current_user.id}")
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev app/controllers/result_csvs_controller.rb
aleph_analytics-0.4.8 app/controllers/result_csvs_controller.rb
aleph_analytics-0.4.7 app/controllers/result_csvs_controller.rb
aleph_analytics-0.4.4 app/controllers/result_csvs_controller.rb
aleph_analytics-0.4.2 app/controllers/result_csvs_controller.rb
aleph_analytics-0.4.1 app/controllers/result_csvs_controller.rb
aleph_analytics-0.3.0 app/controllers/result_csvs_controller.rb
aleph_analytics-0.2.0 app/controllers/result_csvs_controller.rb
aleph_analytics-0.1.0 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.6 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.5 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.4 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.3 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.2 app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.1.alpha app/controllers/result_csvs_controller.rb
aleph_analytics-0.0.0.alpha app/controllers/result_csvs_controller.rb