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.
49 50 51 52 53 54 55 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 49 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
40 41 42 43 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 40 def formats @formats ||= [:csv, :xml, :json] @formats.clone end |