Class: BillingReportsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- BillingReportsController
- Defined in:
- app/controllers/billing_reports_controller.rb
Overview
rubocop:todo Style/Documentation
Constant Summary
Constants included from FlashTruncation
FlashTruncation::STRING_OVERHEAD
Instance Method Summary collapse
Methods inherited from ApplicationController
#block_api_access, #clean_params_from_check, #evil_parameter_hack!, #extract_header_info, #set_cache_disabled!
Methods included from FlashTruncation
#max_flash_size, #truncate_flash, #truncate_flash_array
Instance Method Details
#billing_report_params ⇒ Object
19 20 21 |
# File 'app/controllers/billing_reports_controller.rb', line 19 def billing_report_params params.require(:billing_report).permit(:start_date, :end_date, :file_name) if params[:billing_report].present? end |
#create ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/billing_reports_controller.rb', line 6 def create @billing_report = Billing::Report.new(billing_report_params.merge(fields: Billing.configuration.fields)) if @billing_report.valid? send_data @billing_report.data, type: 'text', filename: "#{@billing_report.file_name}.bif", disposition: 'attachment' else flash.now[:error] = @billing_report.errors..join(', ') render :new end end |