Class: Comable::Admin::ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Includes:
Comable::ApplicationHelper
Defined in:
app/controllers/comable/admin/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#current_abilityObject



11
12
13
# File 'app/controllers/comable/admin/application_controller.rb', line 11

def current_ability
  Comable::Ability.new(current_comable_user)
end

#respond_to_export_with(records) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/comable/admin/application_controller.rb', line 15

def respond_to_export_with(records)
  respond_to do |format|
    format.csv do
      render csv: records, filename: filename
    end

    format.xlsx do
      render xlsx: 'export', filename: filename, locals: { records: records }, template: 'comable/admin/shared/export', layout: false
    end
  end
end