activeadmin-plugins / active_admin_import

:paperclip: active_admin_import is based on activerecord-import gem - the most efficient way to import for ActiveAdmin
http://activeadmin-plugins.github.io/active_admin_import
MIT License
184 stars 101 forks source link

Add possibility to skip columns/values in CSV #149

Closed workgena closed 6 years ago

workgena commented 6 years ago

Add function batch_slice_columns which meant to resolve issue when CSV contains some redundant columns, or columns not existing in corresponding Model

Usage example:

ActiveAdmin.register Post
  active_admin_import before_batch_import: lambda { |importer|
                        importer.batch_slice_columns(['name', 'birthday'])
                      }
end

In this example Post has columns 'name', 'last_name' and 'birthday' And on import only 'name' and 'birthday' will be used in INSERT-SQL

Changes to be committed:

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.07%) to 97.778% when pulling 5bf7e3e9954a16cfb641a01b8a7205bb3ab6919d on workgena:slice_insert_columns into b491d732217da040e828e369717b1b573cfa03eb on activeadmin-plugins:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.07%) to 97.778% when pulling 5bf7e3e9954a16cfb641a01b8a7205bb3ab6919d on workgena:slice_insert_columns into b491d732217da040e828e369717b1b573cfa03eb on activeadmin-plugins:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.07%) to 97.778% when pulling 5bf7e3e9954a16cfb641a01b8a7205bb3ab6919d on workgena:slice_insert_columns into b491d732217da040e828e369717b1b573cfa03eb on activeadmin-plugins:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.07%) to 97.778% when pulling fbd2459b58bf070157f5722b579cd4bfaf6c3225 on workgena:slice_insert_columns into b491d732217da040e828e369717b1b573cfa03eb on activeadmin-plugins:master.