Activeadmin Extension: CSV data import _ror

Source: Internet
Author: User
Importing Data

By default, the interface allows us to create records one by one. This can is inefficient if we have a lot of data that we need to save or we want to use data from another application. It ' s possible to enable CSV importation in the application.

We ll use the active_admin_importable gem for this. In your Gemfile add:

Gem ' active_admin_importable '

And then execute bundle install.

To enable CSV import on the Author page, in app/admin/author.rb add the following.

Active_admin_importable

An Import Authors button would have appeared at the top right corner of the page. Click on it and browse your local file system for the CSV file with want to import. The file should have a header row corresponding with your model attributes. You don ' t have to include all columns, as default values would be inserted for columns your leave out.

I created a CSV file with the following two records and imported it.

The Name,last name
Jane,doe

John,doe

Turn from: http://www.sitepoint.com/easy-admin-interfaces-active-admin-rails/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.