Allow user to export/import of ActiveRecord records and associated records in ActiveAdmin.
Add "exportable" to
ActiveAdmin.register Blog do
exportable includes: [:posts], format: :json, remove_ids: true, filename_method: :my_custom_filename_method
end
Default: []
Use the same syntax of ActiveRecord includes.
Default: 'json'
Export will accept anything "to_format", like json and yaml, but import will only accept 'json' and 'yaml'.
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.
If you dont define this the name os files will be "#{the_resource_class_name}_#{id}"
Add this line to your application's Gemfile:
gem 'active_admin-exportable', '~> 0.1.0'
And then execute:
$ bundle