Skip to content
Clément Prod'homme edited this page May 22, 2019 · 11 revisions

Wiki contains miscellaneous examples of active_admin_import usage.

For default options

back: { action: :import },
csv_options: {},
template: 'admin/import',
fetch_extra_options_from_params: [],
resource_class: config.resource_class,
resource_label:  config.resource_label,
plural_resource_label: config.plural_resource_label,

call without arguments

ActiveAdmin.register Post  do
   active_admin_import
end

FYI, current user should be authorized to perform imports

Cancan(can) Example

class Ability
  include CanCan::Ability
  def initialize(user)
    ...
    can :import, Payment
    ...
  end
end