active_interaction-extras 1.0.1 → 1.0.2

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: a71a37d918c487996272cfff3fab64da2241f0f071a659ff5f9cac97f76bf869
4
- data.tar.gz: 15bc8f3f20329df47325103a6c5971848d0c5c22eca399a0be2e28ba0c6abc52
3
+ metadata.gz: 388877d30b968d835dd575246ce422c76869152aa48e5c5d092d77b43f35764f
4
+ data.tar.gz: da305c4468eaacca6ec6cf9a5c81f7bec3b2cceee1cd1e295fe06d654bdd8ea4
5
5
  SHA512:
6
- metadata.gz: 940a9e9195a01433b060227d3ff02450ac2b620972cf493f3760f9977b5106c071241aef5b5d9c1cef35d39937cfdae8efc2d81c508f4f68b6fe6d5b8ac5cd44
7
- data.tar.gz: d4358a521172fbca3c27be32b41bd5ba4c9cb0df79a5f1b3a2d5539b39f7d04ea5ee73a2abaeab5585529c71701821db2de599a253aaa7ce0ee93f1d808381b4
6
+ metadata.gz: c93f2d6aefa7015c27b34ec33c18d26c912099e85894987a9bbaca137cd52d3ff40842f9343a2c4ca3d4b79ef7bf672a03f8f328e0aaddf94943907a19c2db40
7
+ data.tar.gz: 69756c3fd8da5ac3e9bbbc209b8c4b7456b99c1203161f3df5cb15e7c0b2f1a40eb258b1b61663f4fc5fba2b5d639c97c2a6c516ae71ac5d588d42c8df674e41
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.0.2] - 2021-07-07
8
+
9
+ - Requires active_interaction v4.0.2 or higher
10
+ - Fixed `run_in_transaction!` to rollback when interaction finished with errors
11
+
7
12
  ## [1.0.1] - 2021-05-13
8
13
 
9
14
  - Fix `run_in_transaction` in ruby 3 [#8](https://github.com/antulik/active_interaction-extras/pull/8)
data/README.md CHANGED
@@ -390,7 +390,8 @@ The gem is available as open source under the terms of the [MIT License](https:/
390
390
 
391
391
  ## Credits
392
392
 
393
- ActiveInteraction::Extras is brought to you by [Anton Katunin](https://github.com/antulik) and was originally built at [CarNextDoor](https://www.carnextdoor.com.au/).
393
+ * ActiveInteraction::Extras is brought to you by [Anton Katunin](https://github.com/antulik) and was originally built at [CarNextDoor](https://www.carnextdoor.com.au/).
394
+ * Further improvements to this gem brought to you by [Anton Katunin](https://github.com/antulik) once again and the [Split Payments team](https://github.com/splitpayments/split).
394
395
 
395
396
  ## Code of Conduct
396
397
 
@@ -24,10 +24,11 @@ Gem::Specification.new do |spec|
24
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
25
25
  spec.require_paths = ["lib"]
26
26
 
27
- spec.add_dependency "active_interaction", ">= 4"
27
+ spec.add_dependency "active_interaction", ">= 4.0.2"
28
28
  spec.add_dependency "rails", ">= 6.0"
29
29
  spec.add_development_dependency "bundler", "~> 2.2"
30
30
  spec.add_development_dependency "rake", ">= 12.3.3"
31
31
  spec.add_development_dependency "rspec", "~> 3.7"
32
32
  spec.add_development_dependency "pry"
33
+ spec.add_development_dependency "sqlite3"
33
34
  end
@@ -46,6 +46,10 @@ module ActiveInteraction::Extras::ModelFields
46
46
  alias file custom_filter_attribute
47
47
  alias boolean custom_filter_attribute
48
48
  alias array custom_filter_attribute
49
+ alias record custom_filter_attribute
50
+
51
+ alias anything custom_filter_attribute
52
+ alias uuid custom_filter_attribute
49
53
  end
50
54
 
51
55
  # checks if value was given to the service and the value is different from
@@ -64,7 +68,7 @@ module ActiveInteraction::Extras::ModelFields
64
68
  end
65
69
 
66
70
  # overwritten to pre-populate model fields
67
- def populate_filters(_inputs)
71
+ def populate_filters_and_inputs(_inputs)
68
72
  super.tap do
69
73
  self.class.filters.each do |name, filter|
70
74
  next if given?(name)
@@ -1,7 +1,7 @@
1
1
  module ActiveInteraction::Extras::StrongParams
2
2
  extend ActiveSupport::Concern
3
3
 
4
- def process_inputs(inputs)
4
+ def initialize(inputs = {})
5
5
  # TODO: whitelist :params and :form_params, so they could not be used as filters
6
6
  return super if self.class.filters.key?(:params) || self.class.filters.key?(:form_params)
7
7
 
@@ -9,6 +9,7 @@ module ActiveInteraction::Extras::Transaction
9
9
  set_callback :execute, :around, ->(_interaction, block) {
10
10
  ActiveRecord::Base.transaction(**run_in_transaction_options) do
11
11
  block.call
12
+ raise ActiveRecord::Rollback if _interaction.errors.any?
12
13
  end
13
14
  }, if: :run_in_transaction_options
14
15
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveInteraction
2
2
  module Extras
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_interaction-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Katunin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-13 00:00:00.000000000 Z
11
+ date: 2021-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_interaction
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4'
19
+ version: 4.0.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4'
26
+ version: 4.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: Extensions for active_interaction gem
98
112
  email:
99
113
  - antulik@gmail.com