Class: EasyReports::ReportsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



24
25
26
27
28
29
30
31
32
# File 'app/controllers/easy_reports/reports_controller.rb', line 24

def create
  @report = Report.new(report_params)

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

#destroyObject



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

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

#editObject



21
22
# File 'app/controllers/easy_reports/reports_controller.rb', line 21

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



17
18
19
# File 'app/controllers/easy_reports/reports_controller.rb', line 17

def new
  @report = Report.new
end

#showObject



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

def show
end

#updateObject



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

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