Module: ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper::ClassMethods
- Defined in:
- lib/active_admin/view_helpers/download_format_links_helper.rb
Instance Method Summary collapse
-
#add_format(extension) ⇒ Array
Adds a mime type extension to the list of available formats.
-
#formats ⇒ Array
A ready only of formats to make available in index/paginated collection view.
Instance Method Details
#add_format(extension) ⇒ Array
Adds a mime type extension to the list of available formats. You must register the extension prior to adding it to the list of avilable formats. This should be used by plugins that want to add additional formats to the download format links.
23 24 25 26 27 28 29 30 31 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 23 def add_format extension unless formats.include?(extension) if Mime::Type.lookup_by_extension(extension).nil? raise ArgumentError, "The mime extension you defined: #{extension} is not registered. Please register it via Mime::Type.register before adding it to the available formats." end @formats << extension end formats end |
#formats ⇒ Array
A ready only of formats to make available in index/paginated collection view. formats
12 13 14 15 |
# File 'lib/active_admin/view_helpers/download_format_links_helper.rb', line 12 def formats @formats ||= [:csv, :xml, :json] @formats.clone end |