deferring 0.8.0 → 0.8.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: 16ac4b671c0daeb7924ebbd1ee8f3261706cbb48f4f28e2e30eb3399debfd2f6
4
- data.tar.gz: 849d826f34488eeb42c31ef2a0827e2cf5d47e270b850d432eeee45439fea75b
3
+ metadata.gz: 81e75a7942010a6fe9e3e7696801b286d919877a1b9b9fe2e60dd988b9a1a57e
4
+ data.tar.gz: 0c312c277072b7831e94933bb5e496f89acbc8abad032537eb871ac52be1d2fd
5
5
  SHA512:
6
- metadata.gz: a47992cf72829202ea50280df6517ec6fa3607b964d2fb20faf441c62b114d634c75675d1bb778cd386179907666ef1733a0f409803e1baeb39305cb7af63515
7
- data.tar.gz: 1497c96ecfcf8100221a5bb0bb24c04ddb1a183c860e683d3c1d70b76d14f2cce9d88c22ce30e07f578ec5a318b707355d175dd6a41e76f0c44c3fd4ab460017
6
+ metadata.gz: 730d5fa707a75a44c6eb6477a918beb0d83333899ed977f274f4ed8c745bb5d8b0fed7193b4086c3f68e0c596e976d2744c6fa5ba7f5d9aedc1646f1d92da196
7
+ data.tar.gz: 509f827d37021a1bda15cdb9bdd1fc363a5261351ef6af1a1ba1644063df5266aec620fe874187cc9e826a048702d04750ab0366ea9049cb499f4d3e31ab2467
data/Appraisals CHANGED
@@ -22,3 +22,8 @@ appraise 'rails-61' do
22
22
  gem 'activerecord', '6.1.7.1'
23
23
  gem 'sqlite3'
24
24
  end
25
+
26
+ appraise 'rails-70' do
27
+ gem 'activerecord', '7.0.8'
28
+ gem 'sqlite3'
29
+ end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.8.0)
4
+ deferring (0.8.2)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.8.0)
4
+ deferring (0.8.2)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.8.0)
4
+ deferring (0.8.2)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.8.0)
4
+ deferring (0.8.2)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.8.0)
4
+ deferring (0.8.2)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "7.0.8"
6
+ gem "sqlite3"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ deferring (0.8.2)
5
+ activerecord (>= 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (7.0.8)
11
+ activesupport (= 7.0.8)
12
+ activerecord (7.0.8)
13
+ activemodel (= 7.0.8)
14
+ activesupport (= 7.0.8)
15
+ activesupport (7.0.8)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ appraisal (2.5.0)
21
+ bundler
22
+ rake
23
+ thor (>= 0.14.0)
24
+ concurrent-ruby (1.2.3)
25
+ diff-lcs (1.5.1)
26
+ i18n (1.14.1)
27
+ concurrent-ruby (~> 1.0)
28
+ mini_portile2 (2.8.5)
29
+ minitest (5.22.2)
30
+ rake (13.1.0)
31
+ rspec (3.13.0)
32
+ rspec-core (~> 3.13.0)
33
+ rspec-expectations (~> 3.13.0)
34
+ rspec-mocks (~> 3.13.0)
35
+ rspec-core (3.13.0)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-expectations (3.13.0)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.13.0)
40
+ rspec-mocks (3.13.0)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.13.0)
43
+ rspec-support (3.13.0)
44
+ sqlite3 (1.7.2)
45
+ mini_portile2 (~> 2.8.0)
46
+ thor (1.3.0)
47
+ tzinfo (2.0.6)
48
+ concurrent-ruby (~> 1.0)
49
+
50
+ PLATFORMS
51
+ x86_64-linux
52
+
53
+ DEPENDENCIES
54
+ activerecord (= 7.0.8)
55
+ appraisal
56
+ bundler
57
+ deferring!
58
+ rake
59
+ rspec
60
+ sqlite3
61
+
62
+ BUNDLED WITH
63
+ 2.2.32
@@ -1,3 +1,3 @@
1
1
  module Deferring
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.2'
3
3
  end
data/lib/deferring.rb CHANGED
@@ -238,17 +238,21 @@ module Deferring
238
238
  unless record.valid?
239
239
  valid = false
240
240
  if autosave
241
- if ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 1
242
- record.errors.each do |error|
243
- attribute = "#{association_name}.#{error.attribute}"
244
- errors.add(attribute, error.message) unless errors.added?(attribute, error.message)
245
- end
246
- else
241
+ if ActiveRecord.version.release < Gem::Version.new('6.1.0')
247
242
  record.errors.each do |attribute, message|
248
243
  attribute = "#{association_name}.#{attribute}"
249
244
  errors[attribute] << message
250
245
  errors[attribute].uniq!
251
246
  end
247
+ else # >= Rails 6.1
248
+ record.errors.group_by_attribute.each do |attribute, errors|
249
+ errors.each do |error|
250
+ self.errors.import(
251
+ error,
252
+ attribute: "#{association_name}.#{attribute}"
253
+ )
254
+ end
255
+ end
252
256
  end
253
257
  else
254
258
  errors.add(association_name)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deferring
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Roestenburg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-19 00:00:00.000000000 Z
11
+ date: 2024-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -109,6 +109,8 @@ files:
109
109
  - gemfiles/rails_60.gemfile.lock
110
110
  - gemfiles/rails_61.gemfile
111
111
  - gemfiles/rails_61.gemfile.lock
112
+ - gemfiles/rails_70.gemfile
113
+ - gemfiles/rails_70.gemfile.lock
112
114
  - lib/deferring.rb
113
115
  - lib/deferring/deferred_association.rb
114
116
  - lib/deferring/deferred_callback_listener.rb