deferring 0.7.1 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -10
- data/Appraisals +7 -7
- data/README.md +1 -1
- data/deferring.gemspec +1 -1
- data/gemfiles/rails_42.gemfile.lock +3 -3
- data/gemfiles/rails_50.gemfile.lock +3 -3
- data/gemfiles/rails_51.gemfile.lock +3 -3
- data/gemfiles/rails_52.gemfile +1 -1
- data/gemfiles/rails_52.gemfile.lock +14 -14
- data/gemfiles/rails_60.gemfile +1 -1
- data/gemfiles/rails_60.gemfile.lock +15 -15
- data/gemfiles/rails_61.gemfile +8 -0
- data/gemfiles/rails_61.gemfile.lock +63 -0
- data/lib/deferring/version.rb +1 -1
- data/lib/deferring.rb +17 -6
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 483b0386e63cef046ab56e350801326a13fefdbc61b3437d7773a594bdc7d3cb
|
4
|
+
data.tar.gz: 300a1af607012499adc4e0e77a9c9f517a5fc41ec9590619da4c32e122d9017e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c57a7ca6222a03482432a740df27ab33980f07645f6365163348d7a105956c3d04173a6d3f710e8b5beff415ac34a81b28e15f4a0dae85b988495de92d1384c1
|
7
|
+
data.tar.gz: 0e449f9d3f137f8e21cbbde3073eba4533a66b983ce1d8784e0dc35d82b0964bc1569fb10734cb16474ae56ece5b346bde2bbb12a2a0bb7dd47afa9b17e135ce
|
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.
|
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.
|
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
|
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'
|
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.
|
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
|
59
|
+
bundler
|
60
60
|
deferring!
|
61
61
|
rake
|
62
62
|
rspec
|
63
63
|
sqlite3 (~> 1.3.6)
|
64
64
|
|
65
65
|
BUNDLED WITH
|
66
|
-
|
66
|
+
2.2.32
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
deferring (0.
|
4
|
+
deferring (0.8.1)
|
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
|
57
|
+
bundler
|
58
58
|
deferring!
|
59
59
|
rake
|
60
60
|
rspec
|
61
61
|
sqlite3 (~> 1.3.6)
|
62
62
|
|
63
63
|
BUNDLED WITH
|
64
|
-
|
64
|
+
2.2.32
|
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
deferring (0.
|
4
|
+
deferring (0.8.1)
|
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
|
57
|
+
bundler
|
58
58
|
deferring!
|
59
59
|
rake
|
60
60
|
rspec
|
61
61
|
sqlite3
|
62
62
|
|
63
63
|
BUNDLED WITH
|
64
|
-
|
64
|
+
2.2.32
|
data/gemfiles/rails_52.gemfile
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
deferring (0.
|
4
|
+
deferring (0.8.1)
|
5
5
|
activerecord (>= 4.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (5.2.
|
11
|
-
activesupport (= 5.2.
|
12
|
-
activerecord (5.2.
|
13
|
-
activemodel (= 5.2.
|
14
|
-
activesupport (= 5.2.
|
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.
|
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.
|
26
|
+
concurrent-ruby (1.1.10)
|
27
27
|
diff-lcs (1.4.4)
|
28
|
-
i18n (1.
|
28
|
+
i18n (1.12.0)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
minitest (5.
|
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.
|
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.
|
55
|
+
activerecord (= 5.2.8.1)
|
56
56
|
appraisal
|
57
|
-
bundler
|
57
|
+
bundler
|
58
58
|
deferring!
|
59
59
|
rake
|
60
60
|
rspec
|
61
61
|
sqlite3
|
62
62
|
|
63
63
|
BUNDLED WITH
|
64
|
-
|
64
|
+
2.2.32
|
data/gemfiles/rails_60.gemfile
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
deferring (0.
|
4
|
+
deferring (0.8.1)
|
5
5
|
activerecord (>= 4.2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.0.
|
11
|
-
activesupport (= 6.0.
|
12
|
-
activerecord (6.0.
|
13
|
-
activemodel (= 6.0.
|
14
|
-
activesupport (= 6.0.
|
15
|
-
activesupport (6.0.
|
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.
|
25
|
+
concurrent-ruby (1.1.10)
|
26
26
|
diff-lcs (1.4.4)
|
27
|
-
i18n (1.
|
27
|
+
i18n (1.12.0)
|
28
28
|
concurrent-ruby (~> 1.0)
|
29
|
-
minitest (5.
|
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.
|
47
|
+
tzinfo (1.2.10)
|
48
48
|
thread_safe (~> 0.1)
|
49
|
-
zeitwerk (2.
|
49
|
+
zeitwerk (2.6.6)
|
50
50
|
|
51
51
|
PLATFORMS
|
52
52
|
ruby
|
53
53
|
|
54
54
|
DEPENDENCIES
|
55
|
-
activerecord (= 6.0.
|
55
|
+
activerecord (= 6.0.6.1)
|
56
56
|
appraisal
|
57
|
-
bundler
|
57
|
+
bundler
|
58
58
|
deferring!
|
59
59
|
rake
|
60
60
|
rspec
|
61
61
|
sqlite3
|
62
62
|
|
63
63
|
BUNDLED WITH
|
64
|
-
|
64
|
+
2.2.32
|
@@ -0,0 +1,63 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
deferring (0.8.1)
|
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
|
data/lib/deferring/version.rb
CHANGED
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,21 @@ module Deferring
|
|
238
238
|
unless record.valid?
|
239
239
|
valid = false
|
240
240
|
if autosave
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
241
|
+
if ActiveRecord::VERSION::MAJOR == 6 && ActiveRecord::VERSION::MINOR == 1
|
242
|
+
record.errors.group_by_attribute.each do |attribute, errors|
|
243
|
+
errors.each do |error|
|
244
|
+
self.errors.import(
|
245
|
+
error,
|
246
|
+
attribute: "#{association_name}.#{attribute}"
|
247
|
+
)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
else
|
251
|
+
record.errors.each do |attribute, message|
|
252
|
+
attribute = "#{association_name}.#{attribute}"
|
253
|
+
errors[attribute] << message
|
254
|
+
errors[attribute].uniq!
|
255
|
+
end
|
245
256
|
end
|
246
257
|
else
|
247
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.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robin Roestenburg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-28 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: '
|
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: '
|
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.
|
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
|