You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why yet another import for ActiveAdmin ? Now with activerecord-import ....
27
+
```
24
28
25
-
"Because plain-vanilla, out-of-the-box ActiveRecord doesn’t provide support for inserting large amounts of data efficiently"
29
+
And then execute:
26
30
27
-
cool features of activerecord-import
31
+
$ bundle
28
32
29
-
activerecord-import can perform validations (fast)
30
-
activerecord-import can perform on duplicate key updates (requires mysql)
31
33
32
34
33
-
So active_admin_import features
35
+
#Why yet another import for ActiveAdmin ? Now with activerecord-import ....
34
36
35
-
Encoding handling
36
-
Two step importing (see example2)
37
-
CSV options
38
-
Ability to prepend CSV headers automatically
39
-
Bulk import (activerecord-import)
40
-
Ability to customize template
41
-
Callbacks support
42
-
Zip files import
43
-
and more ....
37
+
<p>Because plain-vanilla, out-of-the-box ActiveRecord doesn’t provide support for inserting large amounts of data efficiently</p>
44
38
45
-
Options
39
+
Features of activerecord-import
46
40
47
-
# +back+:: resource action to redirect after processing
48
-
# +csv_options+:: hash with column separator, row separator, etc
49
-
# +validate+:: true|false, means perfoem validations or not
50
-
# +batch_size+:: integer value of max record count inserted by 1 query/transaction
51
-
# +before_import+:: proc for before import action, hook called with importer object
52
-
# +after_import+:: proc for after import action, hook called with importer object
53
-
# +before_batch_import+:: proc for before each batch action, called with importer object
54
-
# +after_batch_import+:: proc for after each batch action, called with importer object
55
-
# +on_duplicate_key_update+:: an Array or Hash, tells activerecord-import to use MySQL's ON DUPLICATE KEY UPDATE ability.
56
-
# +timestamps+:: true|false, tells activerecord-import to not add timestamps (if false) even if record timestamps is disabled in ActiveRecord::Base
57
-
# +ignore+:: true|false, tells activerecord-import toto use MySQL's INSERT IGNORE ability
58
-
# +params_keys+:: params values available in callbacks
59
-
# +template+:: custom template rendering
60
-
# +template_object+:: object passing to view
61
-
# +locals+:: local variables for template
62
-
# +resource_class+:: resource class name
63
-
# +resource_label+:: resource label value
64
-
# +headers_rewrites+:: hash with key (csv header) - value (db column name) rows mapping
41
+
<ol>
42
+
<li>activerecord-import can perform validations (fast)</li>
43
+
<li>activerecord-import can perform on duplicate key updates (requires mysql)</li>
44
+
</ol>
65
45
46
+
47
+
66
48
67
49
68
-
Default options values
50
+
# active_admin_import features
51
+
<ol>
52
+
<li>Encoding handling</li>
53
+
<li>Preview before importing (Example 2)</li>
54
+
<li> CSV options</li>
55
+
<li> Ability to prepend CSV headers automatically</li>
56
+
<li>Bulk import (activerecord-import)</li>
57
+
<li>Callbacks</li>
58
+
<li>Zip files</li>
59
+
<li>more...</li>
60
+
</ol>
61
+
62
+
63
+
64
+
65
+
#### Options
66
+
67
+
<table>
68
+
<tr><td>name</td><td>description</td></tr>
69
+
<tr><td>:back</td><td>resource action to redirect after processing</td></tr>
70
+
<tr><td>:csv_options</td><td>hash with column separator, row separator, etc </td></tr>
71
+
<tr><td>:validate</td><td>true|false, means perform validations or not</td></tr>
72
+
<tr><td>:batch_size</td><td>integer value of max record count inserted by 1 query/transaction</td></tr>
73
+
<tr><td>:before_import</td><td>proc for before import action, hook called with importer object</td></tr>
74
+
<tr><td>:after_import</td><td>proc for after import action, hook called with importer object</td></tr>
75
+
<tr><td>:before_batch_import</td><td>proc for before each batch action, called with importer object</td></tr>
76
+
<tr><td>:after_batch_import</td><td>proc for after each batch action, called with importer object</td></tr>
77
+
<tr><td>:on_duplicate_key_update</td><td>an Array or Hash, tells activerecord-import to use MySQL's ON DUPLICATE KEY UPDATE ability.</td></tr>
78
+
<tr><td>:timestamps</td><td>true|false, tells activerecord-import to not add timestamps (if false) even if record timestamps is disabled in ActiveRecord::Base</td></tr>
79
+
<tr><td>:ignore</td><td>true|false, tells activerecord-import toto use MySQL's INSERT IGNORE ability</td></tr>
0 commit comments