lib/avromatic.rb in avromatic-0.11.0 vs lib/avromatic.rb in avromatic-0.11.1
- old
+ new
@@ -40,13 +40,14 @@
def self.build_messaging!
self.messaging = build_messaging
end
- # This method is called as a Rails to_prepare block after the application
- # first initializes and prior to each code reloading.
- def self.prepare!
- nested_models.clear
+ # This method is called as a Rails to_prepare hook after the application
+ # first initializes during boot-up and prior to each code reloading.
+ # For the first call during boot-up we do not want to clear the nested_models.
+ def self.prepare!(skip_clear: false)
+ nested_models.clear unless skip_clear
eager_load_models!
end
def self.eager_load_models=(models)
@eager_load_model_names = Array(models).map { |model| model.is_a?(Class) ? model.name : model }