csv_import_magic 0.0.2 → 0.0.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: 91e56866df8de25c3b9bda2ccbaa09e60dc4b101
4
- data.tar.gz: dde09d1e79b7073f4f7edfff4fc1477200c0d580
3
+ metadata.gz: 899541a2d80fab8ed2cbccb20aa7775d83c4aaab
4
+ data.tar.gz: 934058e353289e5dff781e5f090b41bf66b1d462
5
5
  SHA512:
6
- metadata.gz: 0476a7842f3867cbd9af27f4477747465ce2b515f9a44a56e7ce98382b1dd851c543488143ee45dc88d4e5c77f64ddc6cdba4f431c3b4c8e6fba8d2b5488f7d2
7
- data.tar.gz: 883ce8c45cd32013ef1d6af10dec64030a675ba3925834cf2134d3504630d08a5ca10e24b9aac2c71c5050d056cdea5b32dc5b81214d9d9da0f67a9c9e0c4394
6
+ metadata.gz: e65c9005db327c427a76019ff975e0bda8ba7f22568bbb74d43dc7033da48002baed93bfbbf7aa01f948405793bd2594b9b34c0ee8792a8def23bc1cce792d09
7
+ data.tar.gz: e8a69a3581ad3948cf51acf3756159392291bb517cb79c10b10ef9cee792e8fcc33402d1a17a6e7ff85f30bb68bd1f17d97445bf851ad99aa6e5e6b7adb838a5
@@ -45,6 +45,12 @@ module CsvImportMagic
45
45
  @csv ||= begin
46
46
  content = Paperclip.io_adapters.for(@importer.attachment).read.force_encoding('UTF-8')
47
47
  content = content.encode('UTF-8', content.encoding, invalid: :replace, undef: :replace)
48
+
49
+ if !content.nil?
50
+ content = content.gsub(/\r/, "\n")
51
+ content = content.gsub(/\n\n/, "\n")
52
+ end
53
+
48
54
  ::CSV.parse(content, headers: true, col_sep: column_separator)
49
55
  end
50
56
  end
@@ -1,3 +1,3 @@
1
1
  module CsvImportMagic
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
Binary file
Binary file
@@ -5487,3 +5487,16 @@ Started GET "/assets/application.self-d885a0a66bd595c10edb24f8879f94e334d88be073
5487
5487
 
5488
5488
 
5489
5489
  Started GET "/assets/application.self-8f06a73c35179188914ab50e057157639fce1401c1cdca640ac9cec33746fc5b.js?body=1" for ::1 at 2017-01-25 19:18:32 -0200
5490
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
5491
+ Migrating to AddsAdditionalDataToImporters (20170405100034)
5492
+  (0.0ms) begin transaction
5493
+  (0.9ms) ALTER TABLE "importers" ADD "additional_data" varchar
5494
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20170405100034"]]
5495
+  (0.8ms) commit transaction
5496
+ Migrating to AddsAdditionalAttributesToCompany (20170505100034)
5497
+  (0.1ms) begin transaction
5498
+  (0.3ms) ALTER TABLE "companies" ADD "one_additional_attribute" varchar
5499
+  (0.1ms) ALTER TABLE "companies" ADD "other_additional_attribute" varchar
5500
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20170505100034"]]
5501
+  (0.8ms) commit transaction
5502
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"