Sha256: 378ce3fd6190627b0da04b28be6147081260fad3178a6907fcebece8faa5095d

Contents?: true

Size: 602 Bytes

Versions: 1

Compression:

Stored size: 602 Bytes

Contents

module ActiveAdminImportable
  module DSL
    def active_admin_importable
      action_item :only => :index do
        link_to "Import #{active_admin_config.resource_name.to_s.pluralize}", :action => 'upload_csv'
      end

      collection_action :upload_csv do
        render "admin/csv/upload_csv"
      end

      collection_action :import_csv, :method => :post do
        CsvDb.convert_save(active_admin_config.resource_name.to_s, params[:dump][:file])
        redirect_to :action => :index, :notice => "#{active_admin_config.resource_name.to_s} imported successfully!"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_admin_importable-1.0.0 lib/active_admin_importable/dsl.rb