问题
Using activeadmin, is it possible to perform a batch action on ALL records of a particular Model, instead of the ones just selected on the current page?
回答1:
The default batch actions operate only on the selection from the current page. You'll have to define your own batch action that just ignores the selection and does the operation on all the records.
See http://activeadmin.info/docs/9-batch-actions.html for details - you need to add something like this:
ActiveAdmin.register MyModel do
batch_action :my_action do |selection|
collection = MyModel.all
# ... and do something with the collection
end
end
来源:https://stackoverflow.com/questions/27159477/activeadmin-batch-select-all-pages