Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ In an initializer, include a line like the following:

ActiveAdmin::AsyncExport.from_email_address = 'admin@topshelfclothes.com'

### Change the active admin namespace

If your namespace of active-admin is not Admin you can change it.

ActiveAdmin::AsyncExport.controller_namespace = 'Myadmin'

## Contributing

1. Fork it
Expand Down
8 changes: 8 additions & 0 deletions lib/active_admin/async_export.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,13 @@ def self.from_email_address=(address)
def self.from_email_address
@from_email_address || 'admin@example.com'
end

def self.controller_namespace=(namespace)
@controller_namespace = namespace
end

def self.controller_namespace
@controller_namespace || 'Admin'
end
end
end
4 changes: 2 additions & 2 deletions lib/active_admin/async_export/async_export_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class AsyncExportMailer < ActionMailer::Base
def csv_export(admin_email, model_name, params_json)
params = JSON.parse(params_json)

controller = Kernel::qualified_const_get("Admin::#{model_name}sController").new
controller = Kernel::qualified_const_get("#{ActiveAdmin::AsyncExport.controller_namespace}::#{model_name}sController").new
controller.send('params=', params)

config = controller.send(:active_admin_config)
Expand All @@ -19,7 +19,7 @@ def controller.find_collection(options = {})
:pagination,
:collection_decorator
]

collection = scoped_collection
collection_applies(options).each do |applyer|
collection = send("apply_#{applyer}", collection)
Expand Down