rails_admin_import 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/rails_admin_import/formats/csv_importer.rb +4 -3
- data/lib/rails_admin_import/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c799862da18cc280ba530ca0bdf89c492f725573
|
4
|
+
data.tar.gz: 83702de0110d5d0646c3323933367020761427a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa86b09270e22dcbfcc2b4b98b98597fc3d27711eab969064b1a7f87ee94316779ef5f9b751f7187464c71f30c4d23b1363ee1e93d8056ab95f4379f8482ac6d
|
7
|
+
data.tar.gz: 6c2191818eb60e4ddab360ec9adcec4a9cf899acf2d8e9e96842f3e73cdc0c8d7e59174b223bed94092d7aad74a2334ebfc4cd229f387bd2dfd83e349a1dd757
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ Plugin functionality to add generic import to Rails Admin from CSV, JSON and XLS
|
|
9
9
|
* First, add to Gemfile:
|
10
10
|
|
11
11
|
```
|
12
|
-
gem "rails_admin_import", "~> 2.
|
12
|
+
gem "rails_admin_import", "~> 2.2"
|
13
13
|
```
|
14
14
|
|
15
15
|
* Define configuration in `config/initializers/rails_admin_import.rb`:
|
@@ -394,8 +394,12 @@ gem "rails_admin_import", "~> 1.2.0", require: "rails_admin_import/eager_load"
|
|
394
394
|
|
395
395
|
## Import error due to Rails class reloading
|
396
396
|
|
397
|
+
![error due to class reloading](https://user-images.githubusercontent.com/2566348/51355874-0f83ad00-1a7e-11e9-8e58-46bc4699f2e6.jpg)
|
398
|
+
|
397
399
|
If you get an error like `Error during import: MyModel(#70286054976500) expected, got MyModel(#70286114743280)`, you need restart the rails server and redo the import. This is due to the fact that Rails reloads the ActiveRecord model classes in development when you make changes to them and Rails Admin is still using the old class.
|
398
400
|
|
401
|
+
Another suggestion is to set `config.cache_classes = true` to true in your `development.rb` for Rails Admin Import to work around the ActiveRecord model class reloading issue. See [this comment](https://github.com/stephskardal/rails_admin_import/issues/88#issuecomment-455374671) for more information.
|
402
|
+
|
399
403
|
## Customize the UI
|
400
404
|
|
401
405
|
If you want to hide all the advanced fields from the import UI, you can copy [`app/views/rails_admin/main/import.html.haml`](app/views/rails_admin/main/import.html.haml) to your project at the same path. Add `.hidden` at the end of lines you want to hide.
|
@@ -431,6 +435,8 @@ For example:
|
|
431
435
|
|
432
436
|
* [Japanese translation](https://gist.github.com/higumachan/c4bf669d6446ec509386229f916ba5fc) by Yuta Hinokuma
|
433
437
|
|
438
|
+
* [Brazilian Portuguese translation](https://gist.github.com/tteurs/5a87ff4bc5f24692dab05b3cde0ca9df) by Matheo Gracia Pegoraro
|
439
|
+
|
434
440
|
## Run tests
|
435
441
|
|
436
442
|
1. Clone the repository to your machine
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "csv"
|
2
|
+
require "charlock_holmes"
|
2
3
|
|
3
4
|
module RailsAdminImport
|
4
5
|
module Formats
|
@@ -53,9 +54,9 @@ module RailsAdminImport
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def detect_encoding
|
56
|
-
charset =
|
57
|
-
if charset[
|
58
|
-
from_encoding = charset[
|
57
|
+
charset = CharlockHolmes::EncodingDetector.detect File.read(filename)
|
58
|
+
if charset[:confidence] > 0.6
|
59
|
+
from_encoding = charset[:encoding]
|
59
60
|
from_encoding = "UTF-8" if from_encoding == "ascii"
|
60
61
|
end
|
61
62
|
from_encoding
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_admin_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steph Skardal
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -40,19 +40,19 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: 0.6.6
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: charlock_holmes
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '0.6'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '0.6'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: simple_xlsx_reader
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|