activerecord_csv_importer 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44eb851d750d0fbaa869e101d8e8ea82cff78155
|
4
|
+
data.tar.gz: 930a65e74c117c66c03780f9580e3a8544887cd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7704ec50b0940aadd89bb55b971df9eee9fc68d08cd022a414d095a0741e1b7b2c46e86bf2e61b5602e536fc41f60dd3de7ca63d6452b20aaa48b0f4fa30049a
|
7
|
+
data.tar.gz: 7c5363eddd44dc8b86807af76592434719bbd2d6c275787a745431760f24eedb9fbf4fc12974e45cb0d4444bdb62b88250547ff51c7951cae76ae3777dc49808
|
data/README.md
CHANGED
@@ -1,11 +1,8 @@
|
|
1
1
|
# ActiveRecordCSVImporter
|
2
2
|
|
3
|
-
|
3
|
+
ActiveRecordCSVImporter is a modified version CSVImporter, which uses activerecord-import to speed up processing.
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
The key difference with ActiveRecordCSVImporter is the removal of callback support, since that is incompatible with bulk inserts.
|
8
|
-
Additional config options are available instead to deal with batching and duplicate index support.
|
5
|
+
The key difference with CSVImporter is the removal of callback support, since that is incompatible with bulk inserts. Additional config options are available instead to deal with batching and index conflicts.
|
9
6
|
|
10
7
|
It is compatible with ActiveRecord and any Databases supported by activerecord-import.
|
11
8
|
|
@@ -323,6 +320,10 @@ You can handle exotic encodings with the `encoding` option.
|
|
323
320
|
ImportUserCSV.new(content: "メール,氏名".encode('SJIS'), encoding: 'SJIS:UTF-8')
|
324
321
|
```
|
325
322
|
|
323
|
+
## TODO
|
324
|
+
- Add ability to configure activerecord-import validate: Bool option.
|
325
|
+
- Allow setting a default attribute on columns.
|
326
|
+
|
326
327
|
## Development
|
327
328
|
|
328
329
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -331,7 +332,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
331
332
|
|
332
333
|
## Contributing
|
333
334
|
|
334
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
335
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/desheikh/activerecord_csv_importer.
|
335
336
|
|
336
337
|
## License
|
337
338
|
|
@@ -15,10 +15,16 @@ module ActiveRecordCSVImporter
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
18
|
+
# original csv column names
|
18
19
|
def columns_with_definition_names
|
19
20
|
columns.select(&:definition).map(&:name)
|
20
21
|
end
|
21
22
|
|
23
|
+
# mapped column names
|
24
|
+
def column_definition_names
|
25
|
+
column_definitions.map(&:name).map(&:to_s)
|
26
|
+
end
|
27
|
+
|
22
28
|
def column_name_for_model_attribute(attribute)
|
23
29
|
column = columns.find { |c|
|
24
30
|
c.definition.attribute == attribute if c.definition
|
@@ -53,9 +59,5 @@ module ActiveRecordCSVImporter
|
|
53
59
|
column_definition.match?(name)
|
54
60
|
}
|
55
61
|
end
|
56
|
-
|
57
|
-
def column_definition_names
|
58
|
-
column_definitions.map(&:name).map(&:to_s)
|
59
|
-
end
|
60
62
|
end
|
61
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_csv_importer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zulfiqar Ali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|