deferring 0.3.0 → 0.4.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 +4 -4
- data/.travis.yml +1 -0
- data/Appraisals +4 -0
- data/README.md +1 -1
- data/gemfiles/rails_51.gemfile +7 -0
- data/gemfiles/rails_51.gemfile.lock +64 -0
- data/lib/deferring.rb +13 -13
- data/lib/deferring/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd86f3cc417a4a3415ae6ea1ef923d04fc48bb8b
|
4
|
+
data.tar.gz: 817f111436c5ed093bc65cd212a36b4a94a76f97
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91f7c54cbddfec3c1c72b131a44836b0d5acccaf4a8c35e809412acd5efb28493b65a826ffb036ea805c09ded7bba851b6857ffc586371124620d8767f9e5949
|
7
|
+
data.tar.gz: 67a25d6daaa8d0977e0e88a395e00f1b7f9abe67b849a7dc53892036f8f4f3d0546c4f3c61ef22744efb7ac8ba6d75a09c366a8fbfef9857678278760d2f92ed
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
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.x & 5.
|
9
|
+
Currently supporting Rails 4.x, 5.0 & 5.1 on MRI Ruby 2.3+.
|
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
|
@@ -0,0 +1,64 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
deferring (0.3.0)
|
5
|
+
activerecord (> 4.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (5.1.4)
|
11
|
+
activesupport (= 5.1.4)
|
12
|
+
activerecord (5.1.4)
|
13
|
+
activemodel (= 5.1.4)
|
14
|
+
activesupport (= 5.1.4)
|
15
|
+
arel (~> 8.0)
|
16
|
+
activesupport (5.1.4)
|
17
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
18
|
+
i18n (~> 0.7)
|
19
|
+
minitest (~> 5.1)
|
20
|
+
tzinfo (~> 1.1)
|
21
|
+
appraisal (2.2.0)
|
22
|
+
bundler
|
23
|
+
rake
|
24
|
+
thor (>= 0.14.0)
|
25
|
+
arel (8.0.0)
|
26
|
+
concurrent-ruby (1.0.5)
|
27
|
+
diff-lcs (1.3)
|
28
|
+
i18n (0.9.1)
|
29
|
+
concurrent-ruby (~> 1.0)
|
30
|
+
minitest (5.10.3)
|
31
|
+
rake (12.3.0)
|
32
|
+
rspec (3.7.0)
|
33
|
+
rspec-core (~> 3.7.0)
|
34
|
+
rspec-expectations (~> 3.7.0)
|
35
|
+
rspec-mocks (~> 3.7.0)
|
36
|
+
rspec-core (3.7.0)
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-expectations (3.7.0)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-mocks (3.7.0)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.7.0)
|
44
|
+
rspec-support (3.7.0)
|
45
|
+
sqlite3 (1.3.13)
|
46
|
+
thor (0.20.0)
|
47
|
+
thread_safe (0.3.6)
|
48
|
+
tzinfo (1.2.4)
|
49
|
+
thread_safe (~> 0.1)
|
50
|
+
|
51
|
+
PLATFORMS
|
52
|
+
ruby
|
53
|
+
|
54
|
+
DEPENDENCIES
|
55
|
+
activerecord (= 5.1.4)
|
56
|
+
appraisal
|
57
|
+
bundler (~> 1.3)
|
58
|
+
deferring!
|
59
|
+
rake
|
60
|
+
rspec
|
61
|
+
sqlite3
|
62
|
+
|
63
|
+
BUNDLED WITH
|
64
|
+
1.13.0
|
data/lib/deferring.rb
CHANGED
@@ -207,12 +207,19 @@ module Deferring
|
|
207
207
|
send(:"#{association_name.singularize}_ids=", ids.split(','))
|
208
208
|
end
|
209
209
|
|
210
|
-
# changed_for_autosave?
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
210
|
+
# Prepend #changed_for_autosave? and #reload methods to extend existing
|
211
|
+
# behavior in ActiveRecord.
|
212
|
+
self.prepend(Module.new do
|
213
|
+
define_method :changed_for_autosave? do
|
214
|
+
super() || send(deferred_association_name).changed_for_autosave?
|
215
|
+
end
|
216
|
+
|
217
|
+
define_method :reload do |*args|
|
218
|
+
super(*args).tap do
|
219
|
+
update_deferred_association(association_name, listeners, inverse_association_name, dependent)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
end)
|
216
223
|
|
217
224
|
after_validation :"perform_#{deferred_association_name}_validation!"
|
218
225
|
define_method :"perform_#{deferred_association_name}_validation!" do
|
@@ -261,13 +268,6 @@ module Deferring
|
|
261
268
|
update_deferred_association(association_name, listeners, inverse_association_name, dependent)
|
262
269
|
end
|
263
270
|
|
264
|
-
define_method :"reload_with_#{deferred_association_name}" do |*args|
|
265
|
-
send(:"reload_without_#{deferred_association_name}", *args).tap do
|
266
|
-
update_deferred_association(association_name, listeners, inverse_association_name, dependent)
|
267
|
-
end
|
268
|
-
end
|
269
|
-
alias_method_chain :reload, deferred_association_name
|
270
|
-
|
271
271
|
generate_update_deferred_assocation_method
|
272
272
|
end
|
273
273
|
|
data/lib/deferring/version.rb
CHANGED
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.4.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: 2017-
|
11
|
+
date: 2017-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -119,6 +119,8 @@ files:
|
|
119
119
|
- gemfiles/rails_42.gemfile.lock
|
120
120
|
- gemfiles/rails_50.gemfile
|
121
121
|
- gemfiles/rails_50.gemfile.lock
|
122
|
+
- gemfiles/rails_51.gemfile
|
123
|
+
- gemfiles/rails_51.gemfile.lock
|
122
124
|
- lib/deferring.rb
|
123
125
|
- lib/deferring/deferred_association.rb
|
124
126
|
- lib/deferring/deferred_callback_listener.rb
|