imp_exp 1.1.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94c393f1951d6c5ce96e649b5ddebeb783e4602d136808852826903bdc656374
|
|
4
|
+
data.tar.gz: e4ddda971aeaa6f46fce2fa376dfd904b7e3f1fc43a289aef5d6980ec6520e0e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d192022028986ba40750b6abe36b480c0a7167657b71cb2a2528edc4760bfaa61f1a543a73a6893cdf1fd916bfd70ccc2d8aee6f5cbaa95107d9801a79fc2be
|
|
7
|
+
data.tar.gz: 8ffdaf906fa00dbc63613d18334aef5f5c89007e892dcc17669f35efcbe7cea9696fd3d43696e2f8435e1ee2fe93f804c4567d5f0ea3444bf6fc36109ec45f9f
|
|
@@ -82,8 +82,7 @@ module ImpExp
|
|
|
82
82
|
end
|
|
83
83
|
|
|
84
84
|
begin
|
|
85
|
-
if
|
|
86
|
-
model.after_save(record)
|
|
85
|
+
if model.save(record)
|
|
87
86
|
@imported[model.model_name] += 1
|
|
88
87
|
next
|
|
89
88
|
end
|
|
@@ -145,7 +144,7 @@ module ImpExp
|
|
|
145
144
|
|
|
146
145
|
full_file_path = File.join(files_directory_path, file_path.strip)
|
|
147
146
|
begin
|
|
148
|
-
file = File.open(full_file_path)
|
|
147
|
+
file = File.open(full_file_path) # rubocop:disable Style/FileOpen
|
|
149
148
|
record.send(file_attribute_name).attach(io: file, filename: File.basename(file_path))
|
|
150
149
|
rescue Errno::ENOENT
|
|
151
150
|
error_msg = I18n.t('imp_exp.importer.file_not_found', file_path: file_path)
|
|
@@ -143,7 +143,9 @@ module ImpExp
|
|
|
143
143
|
"#{active_storage_file.name}-#{active_storage_file.record.code}#{file_extension(active_storage_file)}"
|
|
144
144
|
end
|
|
145
145
|
|
|
146
|
-
def
|
|
146
|
+
def save(record)
|
|
147
|
+
record.save(context: :import)
|
|
148
|
+
end
|
|
147
149
|
|
|
148
150
|
private
|
|
149
151
|
|
|
@@ -26,7 +26,7 @@ module ImpExp
|
|
|
26
26
|
return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} error | #{message}")]
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
unless data.is_a?(Array) && data.all?
|
|
29
|
+
unless data.is_a?(Array) && data.all?(Hash)
|
|
30
30
|
return [ImpExp::Serializers::Errors::WrongFormat.new("#{relation_name} should be an array of hashes")]
|
|
31
31
|
end
|
|
32
32
|
|
data/lib/imp_exp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: imp_exp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dev team Nerya
|
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
140
|
version: '0'
|
|
141
141
|
requirements: []
|
|
142
|
-
rubygems_version: 4.0.
|
|
142
|
+
rubygems_version: 4.0.10
|
|
143
143
|
specification_version: 4
|
|
144
144
|
summary: Import data from xlsx into a rails app and export data to xlsx from a rails
|
|
145
145
|
app
|