Sha256: 15454075d96166f7c52e5a46f6ff09027109c083a5b9f7361d13fc6d693e4274

Contents?: true

Size: 833 Bytes

Versions: 3

Compression:

Stored size: 833 Bytes

Contents

module ReportCat
  class ReportsController < ApplicationController

    layout :set_layout

    before_action :_authenticate!
    before_action :_authorize!
    before_action :set_reports

    def index
    end

    def show
      @report = @reports[ params[ :id ] ]
      @report.back = params[ :back ]
      @report.generate( params.to_unsafe_hash )

      respond_to do |format|
        format.html
        format.csv { render :plain => @report.to_csv, :content_type => 'text/csv' }
      end
    end

  protected

    def set_reports
      @reports = ReportCat.reports
    end

    def set_layout
      return ReportCat.config.layout
    end

    def _authenticate!
      instance_eval( &ReportCat.config.authenticate_with )
    end

    def _authorize!
      instance_eval( &ReportCat.config.authorize_with )
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
report_cat-5.0.3 app/controllers/report_cat/reports_controller.rb
report_cat-5.0.2 app/controllers/report_cat/reports_controller.rb
report_cat-5.0.1 app/controllers/report_cat/reports_controller.rb