Module: ActiveAdmin::Exporter::ResourceControllerExtension
- Defined in:
- lib/active_admin/exporter/resource_controller_extension.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/active_admin/exporter/resource_controller_extension.rb', line 4 def self.included(base) base.send(:alias_method, :index_without_email, :index) base.send(:alias_method, :index, :index_with_email) base.send(:respond_to, :email) end |
Instance Method Details
#index_with_email ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/active_admin/exporter/resource_controller_extension.rb', line 11 def index_with_email index_without_email do |format| format.email do current_user_method = active_admin_config.namespace.application.current_user_method recipient_email = send(current_user_method).email class_name = self.class.to_s ActiveAdmin::Exporter::ExporterMailer.csv_export( recipient_email, class_name, params.to_json ).deliver_later redirect_back(fallback_location: root_path, notice: "CSV export emailed to #{recipient_email}!") end end end |