Module: ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper::ClassMethods
- Defined in:
- lib/active_admin/view_helpers/download_format_links_helper.rb
Instance Method Summary collapse
-
#add_format(format) ⇒ Array
Adds a mime type to the list of available formats available for data export.
-
#formats ⇒ Array
A ready only of formats to make available in index/paginated collection view.
Instance Method Details
#add_format(format) ⇒ Array
Adds a mime type to the list of available formats available for data export. You must register the extension prior to adding it here.
47 48 49 50 51 52 53 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 47 def add_format(format) unless Mime::Type.lookup_by_extension format raise ArgumentError, "Please register the #{format} mime type with `Mime::Type.register`" end @formats << format unless formats.include? format formats end |
#formats ⇒ Array
A ready only of formats to make available in index/paginated collection view. formats
38 39 40 41 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 38 def formats @formats ||= [:csv, :xml, :json] @formats.clone end |