module ActiveAdmin::ViewHelpers::DownloadFormatLinksHelper::ClassMethods
Public Instance Methods
add_format(extension)
click to toggle source
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. @param [Symbol] extension the mime extension to add @return [Array] A copy of the updated formats array.
# 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()
click to toggle source
A ready only of formats to make available in index/paginated collection view. @return [Array] @see add_format
for information on adding custom download link formats
# File lib/active_admin/view_helpers/download_format_links_helper.rb, line 12 def formats @formats ||= [:csv, :xml, :json] @formats.clone end