Class: Crm::Reports::SourcesReportController

Inherits:
CrmController
  • Object
show all
Includes:
Controllers::ReportCommandFlashable
Defined in:
app/controllers/crm/reports/sources_report_controller.rb

Overview

Controller: sources report.

Instance Method Summary collapse

Instance Method Details

#showObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/crm/reports/sources_report_controller.rb', line 8

def show
  @report_command = ::Report::SourcesReport::SourcesReportCommand.new(sources_report_command_params)
  @result = @report_command.execute

  flash_report_command_errors
  # `warnings` is nil when the command bails out of `execute` early on a
  # validation failure (it never runs `check_for_warnings`). Guard with
  # Array() so an invalid form re-render doesn't blow up here.
  flash.now[:warning] = Array(@report_command.warnings).join('.') if Array(@report_command.warnings).any?
  respond_to do |format|
    format.html
    format.turbo_stream
  end
end