deferring 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf753ccbdb9acdc1f4ef4af594315caa60b68895
4
- data.tar.gz: 5dd367686b2102d0e904f71a52cf3b35f252a067
3
+ metadata.gz: dd86f3cc417a4a3415ae6ea1ef923d04fc48bb8b
4
+ data.tar.gz: 817f111436c5ed093bc65cd212a36b4a94a76f97
5
5
  SHA512:
6
- metadata.gz: 0a5c30f9649f72edce92aa48c772d050c0fc8bdc87ed122fa1b4acf6ccb52aa410243ad86cb0f10dbf612276e98e0fdbfb0aaefee787013f6bbe1f325ec03b09
7
- data.tar.gz: e631910b62aab2e4c586d6e6803f2af1649d351b9e2ddb5f35bc83c9ea89c8d0bb29700cdcecccc1724611234c560cc1c6712c8566735afd2edf48e96883a8e1
6
+ metadata.gz: 91f7c54cbddfec3c1c72b131a44836b0d5acccaf4a8c35e809412acd5efb28493b65a826ffb036ea805c09ded7bba851b6857ffc586371124620d8767f9e5949
7
+ data.tar.gz: 67a25d6daaa8d0977e0e88a395e00f1b7f9abe67b849a7dc53892036f8f4f3d0546c4f3c61ef22744efb7ac8ba6d75a09c366a8fbfef9857678278760d2f92ed
@@ -11,6 +11,7 @@ gemfile:
11
11
  - gemfiles/rails_41.gemfile
12
12
  - gemfiles/rails_42.gemfile
13
13
  - gemfiles/rails_50.gemfile
14
+ - gemfiles/rails_51.gemfile
14
15
 
15
16
  sudo: false
16
17
 
data/Appraisals CHANGED
@@ -13,3 +13,7 @@ end
13
13
  appraise 'rails-50' do
14
14
  gem 'activerecord', '5.0.2'
15
15
  end
16
+
17
+ appraise 'rails-51' do
18
+ gem 'activerecord', '5.1.4'
19
+ 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.x & 5.0 on MRI Ruby 2.3+.
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,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "5.1.4"
6
+
7
+ gemspec :path => "../"
@@ -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
@@ -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
- define_method(:"changed_for_autosave_with_#{deferred_association_name}?") do
212
- changed = send(:"changed_for_autosave_without_#{deferred_association_name}?")
213
- changed || send(deferred_association_name).changed_for_autosave?
214
- end
215
- alias_method_chain :changed_for_autosave?, deferred_association_name
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
 
@@ -1,3 +1,3 @@
1
1
  module Deferring
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
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.3.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-03-08 00:00:00.000000000 Z
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