Sometimes you may want to limit ActiveAdmins export functionality.

This can be done by adding the below snippit into a monkeypatch/rails initializer

Monkey Patch:

1
2
3
4
5
6
7
8
9
10
11
12
13
module ActiveAdmin
  module Views
    class PaginatedCollection
      def build_pagination_with_formats(options)
        div :id => "index_footer" do
          build_pagination
          div(page_entries_info(options).html_safe, :class => "pagination_information")
          build_download_format_links([:csv]) unless @download_links == false
        end
      end
    end
  end
end

Once the code is in place, a restart of your rails server may be required, followed by a change to the activeadmin template

by changing this line:

1
build_download_format_links([:csv]) 

To Suite export formats required (:csv,:xml,:json)


Comments
comments powered by Disqus