GithubHelp home page GithubHelp logo

kennym / active_admin_import Goto Github PK

View Code? Open in Web Editor NEW

This project forked from activeadmin-plugins/active_admin_import

0.0 2.0 0.0 241 KB

active_admin_import is based on activerecord-import gem - the most efficient way to import for ActiveAdmin

Home Page: http://fivell.github.io/active_admin_import

License: MIT License

Ruby 98.39% HTML 1.61%

active_admin_import's Introduction

ActiveAdminImport

The most fastest and efficient CSV import for Active Admin with support of validations, bulk inserts and encodings handling

Build Status Dependency Status Coverage Status

Code Climate Gem Version License

master can be used with AA 1.0.0 and Rails >= 4.1

#Installation

Add this line to your application's Gemfile:

gem "active_admin_import" , '2.1.2'

or

gem "active_admin_import" , github: "activeadmin-plugins/active_admin_import"

And then execute:

$ bundle

active_admin_import features

  1. Replacements/Updates support
  2. Encoding handling
  3. CSV options
  4. Ability to descibe/change CSV headers
  5. Bulk import (activerecord-import)
  6. Callbacks
  7. Zip files
  8. and more...

Basic usage

ActiveAdmin.register Post
  active_admin_import options
end

Options

Tool Description
:back resource action to redirect after processing
:csv_options hash with column separator, row separator, etc
:validate bool means perform validations or not
:batch_size integer value of max record count inserted by 1 query/transaction
:before_import proc for before import action, hook called with importer object
:after_import proc for after import action, hook called with importer object
:before_batch_import proc for before each batch action, called with importer object
:after_batch_import proc for after each batch action, called with importer object
:on_duplicate_key_update an Array or Hash, tells activerecord-import to use MySQL's ON DUPLICATE KEY UPDATE ability.
:timestamps bool, tells activerecord-import to not add timestamps (if false) even if record timestamps is disabled in ActiveRecord::Base
:ignore bool, tells activerecord-import toto use MySQL's INSERT IGNORE ability
:template custom template rendering
:template_object object passing to view
:resource_class resource class name
:resource_label resource label value
:plural_resource_label pluralized resource label value (default config.plural_resource_label)
:headers_rewrites hash with key (csv header) - value (db column name) rows mapping

Wiki

Check various examples

Dependencies

Tool Description
rchardet Character encoding auto-detection in Ruby. As smart as your browser. Open source.
activerecord-import Powerful library for bulk inserting data using ActiveRecord.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

active_admin_import's People

Contributors

bitdeli-chef avatar chechaoyang avatar fivell avatar kennym avatar owyongsk avatar workgena avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.