Class: EasyReports::ReportsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/easy_reports/reports_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/easy_reports/reports_controller.rb', line 18

def create
  @report_form = ReportForm.new(report_params)

  if @report_form.save
    redirect_to @report_form, notice: 'Report was successfully created.'
  else
    render :new
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/easy_reports/reports_controller.rb', line 43

def destroy
  @report.destroy
  redirect_to reports_url, notice: 'Report was successfully destroyed.'
end

#editObject



32
33
# File 'app/controllers/easy_reports/reports_controller.rb', line 32

def edit
end

#indexObject



7
8
9
10
11
12
# File 'app/controllers/easy_reports/reports_controller.rb', line 7

def index
  @reports = Report.all

  database_mediator = EasyReports::DatabaseMediator.new
  @table_list = database_mediator.tables
end

#newObject



14
15
16
# File 'app/controllers/easy_reports/reports_controller.rb', line 14

def new
  @report_form = ReportForm.new
end

#showObject



29
30
# File 'app/controllers/easy_reports/reports_controller.rb', line 29

def show
end

#updateObject



35
36
37
38
39
40
41
# File 'app/controllers/easy_reports/reports_controller.rb', line 35

def update
  if @report.update(report_params)
    redirect_to @report, notice: 'Report was successfully updated.'
  else
    render :edit
  end
end