abstract_importer 1.7.0 → 1.8.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
  SHA256:
3
- metadata.gz: beb6af75a939202a48788cb3cbd6513c074ff514f1d8c7d104b32700ffdcfe63
4
- data.tar.gz: 7ce453f1c101cb56a17642d5b0d21414db6cfd7de3221567f5bce75b4850e93f
3
+ metadata.gz: 14a8a74653aaaf12e7dfa92c53d45220c23ffcab5899a6a39d0094f6ae5b80b2
4
+ data.tar.gz: be3ee5d19164f9ef5fb8b3cbecb7d9ab07abd39dca0ae15684d3a2b407cb1b9c
5
5
  SHA512:
6
- metadata.gz: b17a2f043ce0a0a7fde5e6de5f1bea224d27142c7bfece25a3e890be4bfb0b4110d6413384949a8d3af4eeec19ad688a8e940556a55e65fa6ef9450468332a20
7
- data.tar.gz: 70a4b060155c6f3104f57654340af8dc43816cddbd1a83c49295b647241e326f7e1edc163f7bf673a3d251cf7d02b7734c320cfceae85e3e277705676756f096
6
+ metadata.gz: 8cb7cd6d795367ed66d09fd6bd36f09c50c5cbbd663fe3ed9a84e44582bdf1b6dc66c570b77e6c1e57e9adb7babcf845ba2ceb0b4a36cf7de99bf6ecb84c25cf
7
+ data.tar.gz: 9db676b2fdd24b9200ddcf102cac0eccf3c8b527f3ce97d171e2526fb5132592eea1eb8ba399a300df15ec187bdd0d57122b56d8b1c979c2c02a6dce7ae2f1ba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## v1.8.0 (2021 Dec 10)
2
+ * Added `prepare_scope` as another callback that can be used when importing a collection
3
+
1
4
  ## v1.7.0 (2021 Nov 19)
2
5
  * Updated to handle `insert_all` and `upsert_all` to `has_many through:` relations in Rails 6.1+
3
6
 
@@ -2,6 +2,7 @@ module AbstractImporter
2
2
  class ImportOptions
3
3
  CALLBACKS = [ :finder,
4
4
  :rescue,
5
+ :prepare_scope,
5
6
  :before_build,
6
7
  :before_batch,
7
8
  :before_create,
@@ -58,6 +58,9 @@ module AbstractImporter
58
58
  if scope.respond_to?(:proxy_association) && scope.proxy_association.reflection.through_reflection?
59
59
  scope = scope.klass
60
60
  end
61
+
62
+ scope = invoke_callback(:prepare_scope, scope) || scope
63
+
61
64
  result = scope.public_send(@bulk_operation, batch, @insert_options)
62
65
  add_batch_to_id_map(result) if remap_ids?
63
66
  end
@@ -1,3 +1,3 @@
1
1
  module AbstractImporter
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Lail
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-19 00:00:00.000000000 Z
11
+ date: 2021-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord