Class: ReportCard::ReportsController

Inherits:
ReportCardController show all
Defined in:
app/controllers/report_card/reports_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



7
8
9
10
11
12
13
14
15
# File 'app/controllers/report_card/reports_controller.rb', line 7

def create
  if ReportCard::Report.exists?(params[:report_name])
    email = instance_eval(&ReportCard.recipient_email)
    ReportCard::Runner.perform_async(params[:report_name], email)
    redirect_to report_card_reports_path, flash: { success: 'Generating report. It will be emailed to you.' }
  else
    redirect_to report_card_reports_path, flash: { error: 'Could not find report' }
  end
end

#indexObject



3
4
5
# File 'app/controllers/report_card/reports_controller.rb', line 3

def index
  @reports = ReportCard::Report.all
end