active_admin_import_anything 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -18,25 +18,18 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
Add the following
|
22
|
-
|
23
|
-
|
24
|
-
active_admin_import_anything
|
25
|
-
|
26
|
-
The Import button should now appear. Click it and upload your file. Press submit.
|
27
|
-
|
28
|
-
## Custom Import Behavior
|
29
|
-
|
30
|
-
Need to do something special with the import? active_admin_importable accepts an optional block that will be called on each row, replacing the default functionality ( calling create! on the associated model). The associated model and a hash of the current row will get passed into the block. For example:
|
21
|
+
Add the following block into your active admin resource:
|
31
22
|
|
32
23
|
```
|
33
24
|
ActiveAdmin.register Product do
|
25
|
+
|
34
26
|
active_admin_import_anything do |file|
|
35
27
|
#write the code to handle the imported file
|
36
28
|
end
|
37
29
|
end
|
38
30
|
```
|
39
31
|
|
32
|
+
The Import button should now appear. Click it and upload your file. Press submit.
|
40
33
|
|
41
34
|
## Contributing
|
42
35
|
|