Sha256: 52be26c0ecc5f43b121b10775cbbe91421b28cbb19b1d3534ad17dad6b7f8790

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

module AdministrateExportable
  module Exporter
    extend ActiveSupport::Concern

    included do
      exportable
    end

    class_methods do
      def exportable
        define_method(:export) do
          csv_data = ExporterService.csv(dashboard, resource_class)

          respond_to do |format|
            format.csv { send_data csv_data, filename: "#{resource_name.to_s.pluralize}-#{Date.today}.csv" }
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
administrate_exportable-0.1.2 lib/administrate_exportable/exporter.rb
administrate_exportable-0.1.1 lib/administrate_exportable/exporter.rb
administrate_exportable-0.1.0 lib/administrate_exportable/exporter.rb