Skip to content

Instantly share code, notes, and snippets.

@lcguida
Last active August 30, 2018 12:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lcguida/c2db46414c080656d923ab6646de61a8 to your computer and use it in GitHub Desktop.
Save lcguida/c2db46414c080656d923ab6646de61a8 to your computer and use it in GitHub Desktop.
Exemplo de batch action ActiveAdmin (Grupo Rails - Facebook)
ActiveAdmin.register MyModel do
# ..
# Configura essa página do active admin para utilizar batch actions
config.batch_actions = true
# Remove a action destory em batch (Você pode controlar outras coisas por aqui)
batch_action :destroy, false
# Cria a action export
batch_action :export do |ids|
file = ZipExporter.generate_file(ids: ids)
send_data(file, filename: "export.zip", type: 'application/zip')
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment