tallty_import_export 1.0.29 → 1.0.30

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
  SHA256:
3
- metadata.gz: 0043f0699fb0631c48a0c1dcd018ccad9cdda7dfa376c0a702bf7857338e04a5
4
- data.tar.gz: 7a8dd851866ea1bc55f87ac8ec443587e6776cfd3c52b8b76fcd9f982aeba513
3
+ metadata.gz: 3d508c090e1c1bf676c46ae3bb2d3d2d0c9d3e4d123853894a668262d9ac27ee
4
+ data.tar.gz: 2f6fee166e44b4e82015a1419da3b7aaad57e71880e26ddcfdfa9fe97cf61572
5
5
  SHA512:
6
- metadata.gz: 406e6ac1fcf1623b2c0de6bd6fb415e15012e2e8f56fd9bf8ec1a552b5b15e528048ea8d9f6f5bce0b16f491941b20dd91a9d246459f4c397f891cf175a95806
7
- data.tar.gz: 6af4e08406d4092107d372f0e8eaa6e5305dff67b9e5db7620151f55fb3b2f7ab3661817187ef4b92fbc85b32d030cd96c33f3c153037683d97fbc2839e7e317
6
+ metadata.gz: 96486980954a1b12f804bbebf6c6bcd1e75ebf191b39cf4e22dfc11b36a4bed21502555b1bc8cce413e2ac1285cfdb360435d505f899e5db1b3c19d5ce09eeb0
7
+ data.tar.gz: 6951da2e23d352e485c28a56b13c03d2789ea4bed2a4ae79207dfebcfa1a8543e70143e8eb68bfd04814cf245ea2c47493468672d4418570049b36af79ee3427
@@ -17,6 +17,7 @@ module TalltyImportExport
17
17
  # json: model_payload,代表存储在某一个列中
18
18
  # finder: 执行代码,可以查找到相关的对象
19
19
  # proc: proc或者lamda,支持call,传入 val 和 context
20
+ # skip: 用来综合使用的数据,但是不导入
20
21
 
21
22
  # xlsx_file 为 file path or file object or TalltyImportExport::Excel.new
22
23
  def import_xlsx xlsx_file, associations, **options
@@ -55,6 +56,7 @@ module TalltyImportExport
55
56
  options = import_options.merge(options).with_indifferent_access
56
57
  @headers = options.delete(:headers) || import_headers
57
58
  @primary_keys = options.delete(:primary_keys) || @headers.map { |header| header[:primary_key] ? header[:key].to_sym : nil }.compact
59
+ @skip_keys = options.delete(:skip_keys) || @headers.map { |header| header[:skip] ? header[:key].to_sym : nil }.compact
58
60
  @params = options
59
61
  context.params = @params
60
62
 
@@ -152,7 +154,7 @@ module TalltyImportExport
152
154
  def import_record line_info, associations
153
155
  if primary_keys.present?
154
156
  _record = associations.find_or_initialize_by(line_info.clone.extract!(*primary_keys))
155
- _record.update!(line_info.clone.except!(*primary_keys))
157
+ _record.update!(line_info.clone.except!(*primary_keys, *@skip_keys))
156
158
  else
157
159
  associations.create!(line_info)
158
160
  end
@@ -1,3 +1,3 @@
1
1
  module TalltyImportExport
2
- VERSION = "1.0.29"
2
+ VERSION = "1.0.30"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tallty_import_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.29
4
+ version: 1.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - liyijie