deferring 0.7.1 → 0.8.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: 14441d2a2db2d40728af34eb27b47b4da1c7961a716be04a10019468298f7cfc
4
- data.tar.gz: ddef46c10b1d7fd9f6e44a1f2e5507937c85e42af8424bc8f2d5d96e156de96a
3
+ metadata.gz: 16ac4b671c0daeb7924ebbd1ee8f3261706cbb48f4f28e2e30eb3399debfd2f6
4
+ data.tar.gz: 849d826f34488eeb42c31ef2a0827e2cf5d47e270b850d432eeee45439fea75b
5
5
  SHA512:
6
- metadata.gz: 54eedbbfc6be7e60b517e38a94c1b0b248dd55e52ef90036ea17e4148c92ccf0b37ed153732e28601368704a238ec8dc9178cf7eacf3cacf3af180306bf6a0a4
7
- data.tar.gz: 4c2f00b244eb1cab289353e5abcb46cdd48e58e656c83dbc5316af84ad826fb20d0974acd57ff5e90e78656044ce0cb800c9f84e87fc4bd8a36065433b0b01b8
6
+ metadata.gz: a47992cf72829202ea50280df6517ec6fa3607b964d2fb20faf441c62b114d634c75675d1bb778cd386179907666ef1733a0f409803e1baeb39305cb7af63515
7
+ data.tar.gz: 1497c96ecfcf8100221a5bb0bb24c04ddb1a183c860e683d3c1d70b76d14f2cce9d88c22ce30e07f578ec5a318b707355d175dd6a41e76f0c44c3fd4ab460017
data/.travis.yml CHANGED
@@ -1,26 +1,17 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.3.8
5
- - 2.4.6
6
4
  - 2.5.5
7
5
  - 2.6.3
8
6
  - 2.7.1
9
7
 
10
8
  gemfile:
11
- - gemfiles/rails_42.gemfile
12
9
  - gemfiles/rails_50.gemfile
13
10
  - gemfiles/rails_51.gemfile
14
11
  - gemfiles/rails_52.gemfile
15
12
  - gemfiles/rails_60.gemfile
13
+ - gemfiles/rails_61.gemfile
16
14
 
17
15
  sudo: false
18
16
 
19
17
  script: 'bundle exec rake'
20
-
21
- matrix:
22
- exclude:
23
- - rvm: 2.3.8
24
- gemfile: gemfiles/rails_60.gemfile
25
- - rvm: 2.4.6
26
- gemfile: gemfiles/rails_60.gemfile
data/Appraisals CHANGED
@@ -1,8 +1,3 @@
1
- appraise 'rails-42' do
2
- gem 'activerecord', '4.2.11.3'
3
- gem 'sqlite3', '~> 1.3.6'
4
- end
5
-
6
1
  appraise 'rails-50' do
7
2
  gem 'activerecord', '5.0.7.2'
8
3
  gem 'sqlite3', '~> 1.3.6'
@@ -14,11 +9,16 @@ appraise 'rails-51' do
14
9
  end
15
10
 
16
11
  appraise 'rails-52' do
17
- gem 'activerecord', '5.2.4.3'
12
+ gem 'activerecord', '5.2.8.1'
18
13
  gem 'sqlite3'
19
14
  end
20
15
 
21
16
  appraise 'rails-60' do
22
- gem 'activerecord', '6.0.3.2'
17
+ gem 'activerecord', '6.0.6.1'
18
+ gem 'sqlite3'
19
+ end
20
+
21
+ appraise 'rails-61' do
22
+ gem 'activerecord', '6.1.7.1'
23
23
  gem 'sqlite3'
24
24
  end
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  Deferring makes it possible to delay saving ActiveRecord associations until the
7
7
  parent object has been saved.
8
8
 
9
- Currently supporting Rails 4.2, 5.0, 5.1 & 5.2 on MRI Ruby 2.3+.
9
+ Currently supporting Rails 5.x, 6.0 & 6.1 on MRI Ruby 2.5+.
10
10
 
11
11
  It is important to note that Deferring does not touch the original `has_many`
12
12
  and `has_and_belongs_to_many` associations. You can use them, without worrying
data/deferring.gemspec CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.add_dependency 'activerecord', ['>= 4.2']
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 1.3'
25
+ spec.add_development_dependency 'bundler'
26
26
  spec.add_development_dependency 'rake'
27
27
  spec.add_development_dependency 'rspec'
28
28
  spec.add_development_dependency 'appraisal'
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.7.0)
4
+ deferring (0.7.1)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -56,11 +56,11 @@ PLATFORMS
56
56
  DEPENDENCIES
57
57
  activerecord (= 4.2.11.3)
58
58
  appraisal
59
- bundler (~> 1.3)
59
+ bundler
60
60
  deferring!
61
61
  rake
62
62
  rspec
63
63
  sqlite3 (~> 1.3.6)
64
64
 
65
65
  BUNDLED WITH
66
- 1.17.3
66
+ 2.2.32
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.7.0)
4
+ deferring (0.8.0)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -54,11 +54,11 @@ PLATFORMS
54
54
  DEPENDENCIES
55
55
  activerecord (= 5.0.7.2)
56
56
  appraisal
57
- bundler (~> 1.3)
57
+ bundler
58
58
  deferring!
59
59
  rake
60
60
  rspec
61
61
  sqlite3 (~> 1.3.6)
62
62
 
63
63
  BUNDLED WITH
64
- 1.17.3
64
+ 2.2.32
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.7.0)
4
+ deferring (0.8.0)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
@@ -54,11 +54,11 @@ PLATFORMS
54
54
  DEPENDENCIES
55
55
  activerecord (= 5.1.7)
56
56
  appraisal
57
- bundler (~> 1.3)
57
+ bundler
58
58
  deferring!
59
59
  rake
60
60
  rspec
61
61
  sqlite3
62
62
 
63
63
  BUNDLED WITH
64
- 1.17.3
64
+ 2.2.32
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "5.2.4.3"
5
+ gem "activerecord", "5.2.8.1"
6
6
  gem "sqlite3"
7
7
 
8
8
  gemspec path: "../"
@@ -1,19 +1,19 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.7.0)
4
+ deferring (0.8.0)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (5.2.4.3)
11
- activesupport (= 5.2.4.3)
12
- activerecord (5.2.4.3)
13
- activemodel (= 5.2.4.3)
14
- activesupport (= 5.2.4.3)
10
+ activemodel (5.2.8.1)
11
+ activesupport (= 5.2.8.1)
12
+ activerecord (5.2.8.1)
13
+ activemodel (= 5.2.8.1)
14
+ activesupport (= 5.2.8.1)
15
15
  arel (>= 9.0)
16
- activesupport (5.2.4.3)
16
+ activesupport (5.2.8.1)
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
18
  i18n (>= 0.7, < 2)
19
19
  minitest (~> 5.1)
@@ -23,11 +23,11 @@ GEM
23
23
  rake
24
24
  thor (>= 0.14.0)
25
25
  arel (9.0.0)
26
- concurrent-ruby (1.1.6)
26
+ concurrent-ruby (1.1.10)
27
27
  diff-lcs (1.4.4)
28
- i18n (1.8.3)
28
+ i18n (1.12.0)
29
29
  concurrent-ruby (~> 1.0)
30
- minitest (5.14.1)
30
+ minitest (5.17.0)
31
31
  rake (13.0.1)
32
32
  rspec (3.9.0)
33
33
  rspec-core (~> 3.9.0)
@@ -45,20 +45,20 @@ GEM
45
45
  sqlite3 (1.4.2)
46
46
  thor (1.0.1)
47
47
  thread_safe (0.3.6)
48
- tzinfo (1.2.7)
48
+ tzinfo (1.2.10)
49
49
  thread_safe (~> 0.1)
50
50
 
51
51
  PLATFORMS
52
52
  ruby
53
53
 
54
54
  DEPENDENCIES
55
- activerecord (= 5.2.4.3)
55
+ activerecord (= 5.2.8.1)
56
56
  appraisal
57
- bundler (~> 1.3)
57
+ bundler
58
58
  deferring!
59
59
  rake
60
60
  rspec
61
61
  sqlite3
62
62
 
63
63
  BUNDLED WITH
64
- 1.17.3
64
+ 2.2.32
@@ -2,7 +2,7 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "6.0.3.2"
5
+ gem "activerecord", "6.0.6.1"
6
6
  gem "sqlite3"
7
7
 
8
8
  gemspec path: "../"
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: ..
3
3
  specs:
4
- deferring (0.7.0)
4
+ deferring (0.8.0)
5
5
  activerecord (>= 4.2)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- activemodel (6.0.3.2)
11
- activesupport (= 6.0.3.2)
12
- activerecord (6.0.3.2)
13
- activemodel (= 6.0.3.2)
14
- activesupport (= 6.0.3.2)
15
- activesupport (6.0.3.2)
10
+ activemodel (6.0.6.1)
11
+ activesupport (= 6.0.6.1)
12
+ activerecord (6.0.6.1)
13
+ activemodel (= 6.0.6.1)
14
+ activesupport (= 6.0.6.1)
15
+ activesupport (6.0.6.1)
16
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
17
  i18n (>= 0.7, < 2)
18
18
  minitest (~> 5.1)
@@ -22,11 +22,11 @@ GEM
22
22
  bundler
23
23
  rake
24
24
  thor (>= 0.14.0)
25
- concurrent-ruby (1.1.6)
25
+ concurrent-ruby (1.1.10)
26
26
  diff-lcs (1.4.4)
27
- i18n (1.8.3)
27
+ i18n (1.12.0)
28
28
  concurrent-ruby (~> 1.0)
29
- minitest (5.14.1)
29
+ minitest (5.17.0)
30
30
  rake (13.0.1)
31
31
  rspec (3.9.0)
32
32
  rspec-core (~> 3.9.0)
@@ -44,21 +44,21 @@ GEM
44
44
  sqlite3 (1.4.2)
45
45
  thor (1.0.1)
46
46
  thread_safe (0.3.6)
47
- tzinfo (1.2.7)
47
+ tzinfo (1.2.10)
48
48
  thread_safe (~> 0.1)
49
- zeitwerk (2.3.1)
49
+ zeitwerk (2.6.6)
50
50
 
51
51
  PLATFORMS
52
52
  ruby
53
53
 
54
54
  DEPENDENCIES
55
- activerecord (= 6.0.3.2)
55
+ activerecord (= 6.0.6.1)
56
56
  appraisal
57
- bundler (~> 1.3)
57
+ bundler
58
58
  deferring!
59
59
  rake
60
60
  rspec
61
61
  sqlite3
62
62
 
63
63
  BUNDLED WITH
64
- 1.17.3
64
+ 2.2.32
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "6.1.7.1"
6
+ gem "sqlite3"
7
+
8
+ gemspec path: "../"
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ deferring (0.8.0)
5
+ activerecord (>= 4.2)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (6.1.7.1)
11
+ activesupport (= 6.1.7.1)
12
+ activerecord (6.1.7.1)
13
+ activemodel (= 6.1.7.1)
14
+ activesupport (= 6.1.7.1)
15
+ activesupport (6.1.7.1)
16
+ concurrent-ruby (~> 1.0, >= 1.0.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
21
+ appraisal (2.4.1)
22
+ bundler
23
+ rake
24
+ thor (>= 0.14.0)
25
+ concurrent-ruby (1.1.10)
26
+ diff-lcs (1.5.0)
27
+ i18n (1.12.0)
28
+ concurrent-ruby (~> 1.0)
29
+ minitest (5.17.0)
30
+ rake (13.0.6)
31
+ rspec (3.12.0)
32
+ rspec-core (~> 3.12.0)
33
+ rspec-expectations (~> 3.12.0)
34
+ rspec-mocks (~> 3.12.0)
35
+ rspec-core (3.12.0)
36
+ rspec-support (~> 3.12.0)
37
+ rspec-expectations (3.12.2)
38
+ diff-lcs (>= 1.2.0, < 2.0)
39
+ rspec-support (~> 3.12.0)
40
+ rspec-mocks (3.12.3)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.12.0)
43
+ rspec-support (3.12.0)
44
+ sqlite3 (1.6.0-x86_64-linux)
45
+ thor (1.2.1)
46
+ tzinfo (2.0.5)
47
+ concurrent-ruby (~> 1.0)
48
+ zeitwerk (2.6.6)
49
+
50
+ PLATFORMS
51
+ x86_64-linux
52
+
53
+ DEPENDENCIES
54
+ activerecord (= 6.1.7.1)
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.7.1'
2
+ VERSION = '0.8.0'
3
3
  end
data/lib/deferring.rb CHANGED
@@ -14,7 +14,7 @@ module Deferring
14
14
  autosave = options.fetch(:autosave, true)
15
15
  validate = options.fetch(:validate, true)
16
16
 
17
- has_and_belongs_to_many(*args, options)
17
+ has_and_belongs_to_many(*args, **options)
18
18
  generate_deferred_association_methods(
19
19
  args.first.to_s,
20
20
  listeners,
@@ -34,7 +34,7 @@ module Deferring
34
34
  autosave = options.fetch(:autosave, true)
35
35
  validate = options.fetch(:validate, true)
36
36
 
37
- has_many(*args, options)
37
+ has_many(*args, **options)
38
38
  generate_deferred_association_methods(
39
39
  args.first.to_s,
40
40
  listeners,
@@ -238,10 +238,17 @@ module Deferring
238
238
  unless record.valid?
239
239
  valid = false
240
240
  if autosave
241
- record.errors.each do |attribute, message|
242
- attribute = "#{association_name}.#{attribute}"
243
- errors[attribute] << message
244
- errors[attribute].uniq!
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
247
+ record.errors.each do |attribute, message|
248
+ attribute = "#{association_name}.#{attribute}"
249
+ errors[attribute] << message
250
+ errors[attribute].uniq!
251
+ end
245
252
  end
246
253
  else
247
254
  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.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Roestenburg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-20 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -28,16 +28,16 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -107,6 +107,8 @@ files:
107
107
  - gemfiles/rails_52.gemfile.lock
108
108
  - gemfiles/rails_60.gemfile
109
109
  - gemfiles/rails_60.gemfile.lock
110
+ - gemfiles/rails_61.gemfile
111
+ - gemfiles/rails_61.gemfile.lock
110
112
  - lib/deferring.rb
111
113
  - lib/deferring/deferred_association.rb
112
114
  - lib/deferring/deferred_callback_listener.rb
@@ -141,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
143
  - !ruby/object:Gem::Version
142
144
  version: '0'
143
145
  requirements: []
144
- rubygems_version: 3.1.4
146
+ rubygems_version: 3.1.6
145
147
  signing_key:
146
148
  specification_version: 4
147
149
  summary: Defer saving ActiveRecord associations until parent is saved