Module: ActiveAdmin::AsyncExport::ResourceControllerExtension
- Defined in:
- lib/active_admin/async_export/resource_controller_extension.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 |
# File 'lib/active_admin/async_export/resource_controller_extension.rb', line 4 def self.included(base) base.send :alias_method_chain, :index, :email base.send :respond_to, :email end |
Instance Method Details
#index_with_email(options = {}, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/active_admin/async_export/resource_controller_extension.rb', line 9 def index_with_email(={}, &block) index_without_email() do |format| format.email do current_user_method = active_admin_config.namespace.application.current_user_method admin_email = send(current_user_method).email ActiveAdmin::AsyncExport::AsyncExportMailer.delay.csv_export(admin_email, collection.first.class.to_s) redirect_to :back, notice: "CSV export emailed to #{admin_email}!" end end end |