ActiveAdmin::Exportable
Allow user to export/import of ActiveRecord records and associated records in ActiveAdmin.
Usage
Add "exportable" to
ActiveAdmin.register Blog do
exportable includes: [:posts], format: :json, remove_ids: true, filename_method: :my_custom_filename_method
end
Options
includes
Default: []
Use the same syntax of ActiveRecord includes.
format
Default: 'json'
Export will accept anything "to_format", like json and yaml, but import will only accept 'json' and 'yaml'.
remove_ids
Default: true
The export will remove ids and association ids to avoid conflict on import in another system. The import process can restore associations creating new ids.
filename_method
If you dont define this the name os files will be "#the_resource_class_name_#id"
Installation
Add this line to your application's Gemfile:
gem 'active_admin-exportable', '~> 0.1.0'
And then execute:
$ bundle