avromatic 0.11.0 → 0.11.1

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: ce7da1b2c3c2ec8741eba98e50a294aa8db18bb1
4
- data.tar.gz: 688813aeb07b275550fda92b30cc97f339ddf142
3
+ metadata.gz: b9b086516351e441fda56c4bd8ba092e94d21138
4
+ data.tar.gz: 620bfdfab8da77dd66a817cdf5735aafd6e923d2
5
5
  SHA512:
6
- metadata.gz: 18c3b5f0a4aa093e9ed2868722f103fcd780361c417ab1a72b5f7e5a6a5c94b658e4100bfd42bbcf14fd30a2d6c0d9a154ee9bb8de4e5823a6ea4d76487d072a
7
- data.tar.gz: 0988f486a37745ddf3e46d027d3b9976665807804c3f0355d05e99ceefa73abdeab881e6bab109f65220c60ee698d944017f9b487931fe75c5e19d6e7a60a9d0
6
+ metadata.gz: 2dde2fdc32aa7b2e9c133ff38e955900ea60a53d484e001488c8d5cc96baf2a767a0ec2776b0992290215eb896e408b8809f5cef1bc727daa9611e45bd7740a6
7
+ data.tar.gz: 51a66b71eda6f2e16175c6d92875ffc3a7ed43e8195987db913bee3e2e98b1ecba51e4848e682f2c14a93414e8566a3ce806684b7aca2900a225ef4beb98dfc2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # avromatic changelog
2
2
 
3
+ ## v0.11.1
4
+ - Another fix for Rails initialization and reloading. Do not clear the nested
5
+ models registry the first time that the `to_prepare` hook is called.
6
+
3
7
  ## v0.11.0
4
8
  - Replace `Avromatic.on_initialize` proc with `Avromatic.eager_load_models`
5
9
  array. The models listed by this configuration are added to the registry
@@ -5,8 +5,19 @@ module Avromatic
5
5
  config.logger = Rails.logger
6
6
  end
7
7
 
8
+ # Rails calls the to_prepare hook once during boot-up, after running
9
+ # initializers. After the to_prepare call during boot-up, no code will
10
+ # we reloaded, so we need to retain the contents of the nested_models
11
+ # registry.
12
+ #
13
+ # For subsequent calls to to_prepare (in development), the nested_models
14
+ # registry is cleared and repopulated by explicitly referencing the
15
+ # eager_loaded_models.
16
+ first_prepare = true
17
+
8
18
  Rails.configuration.to_prepare do
9
- Avromatic.prepare!
19
+ Avromatic.prepare!(skip_clear: first_prepare)
20
+ first_prepare = false
10
21
  end
11
22
  end
12
23
  end
@@ -1,3 +1,3 @@
1
1
  module Avromatic
2
- VERSION = '0.11.0'.freeze
2
+ VERSION = '0.11.1'.freeze
3
3
  end
data/lib/avromatic.rb CHANGED
@@ -42,10 +42,11 @@ module Avromatic
42
42
  self.messaging = build_messaging
43
43
  end
44
44
 
45
- # This method is called as a Rails to_prepare block after the application
46
- # first initializes and prior to each code reloading.
47
- def self.prepare!
48
- nested_models.clear
45
+ # This method is called as a Rails to_prepare hook after the application
46
+ # first initializes during boot-up and prior to each code reloading.
47
+ # For the first call during boot-up we do not want to clear the nested_models.
48
+ def self.prepare!(skip_clear: false)
49
+ nested_models.clear unless skip_clear
49
50
  eager_load_models!
50
51
  end
51
52
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avromatic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Salsify Engineering
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-25 00:00:00.000000000 Z
11
+ date: 2016-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro