Created
July 29, 2011 16:34
-
-
Save pcreux/1114182 to your computer and use it in GitHub Desktop.
active_admin custom collection action with filtering and sorting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActiveAdmin.register Order do | |
# Export the current collection of items with filtering and sorting | |
# List the current collection ids | |
collection_action :export_txt do | |
render :text => collection.map { |order| order.id }.join(', ') | |
end | |
# Add a button to index page to export current collection as txt | |
action_item(:only => :index) do | |
link_to("Export TXT", export_txt_admin_orders_path(params.except("controller", "action"))) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment