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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ad5c6af8848efccee2f00133a0537a41f6ceca8
4
- data.tar.gz: 6928c129f69d8653a0bcdd9d18f905c8191e99fe
3
+ metadata.gz: c799862da18cc280ba530ca0bdf89c492f725573
4
+ data.tar.gz: 83702de0110d5d0646c3323933367020761427a8
5
5
  SHA512:
6
- metadata.gz: 51216c41011b73a8b62c612c4690b740c9d126f0c24f9404086a7354389b05258e79384161d082a62709237936b8e0f0e081a7d40fd376df796391e07ee5e678
7
- data.tar.gz: f6574cd2fac75ccb479d80f0749bc136675024748d8c01baefca6023e871c1d09b970274606b6054bd21d1b24c39517330cba3413d1260866f4a1038697322af
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.1"
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 = CharDet.detect File.read(filename)
57
- if charset["confidence"] > 0.6
58
- from_encoding = charset["encoding"]
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
@@ -1,3 +1,3 @@
1
1
  module RailsAdminImport
2
- VERSION = "2.1.0"
2
+ VERSION = "2.2.0"
3
3
  end
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.1.0
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: 2017-11-18 00:00:00.000000000 Z
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: rchardet
43
+ name: charlock_holmes
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - "~>"
47
47
  - !ruby/object:Gem::Version
48
- version: '1.6'
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: '1.6'
55
+ version: '0.6'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: simple_xlsx_reader
58
58
  requirement: !ruby/object:Gem::Requirement