README.md in avromatic-0.10.0 vs README.md in avromatic-0.11.0
- old
+ new
@@ -39,14 +39,15 @@
`Avro::Schema` objects. See [Models](#models).
* **nested_models**: An optional [ModelRegistry](https://github.com/salsify/avromatic/blob/master/lib/avromatic/model_registry.rb)
that is used to store, by full schema name, the generated models that are
embedded within top-level models. By default a new `Avromatic::ModelRegistry`
is created.
-* **on_initialize**: An optional Proc that runs at the end of
+* **eager_load_models**: An optional array of models, or strings with class
+ names for models, that are added to `nested_models` at the end of
`Avromatic.configure` and during code reloading in Rails applications. This
- option is useful for defining models that will be extended when the load
- order is important.
+ option is useful for defining models that will be extended when the load order
+ is important.
#### Using a Schema Registry/Messaging API
The configuration options below are required when using a schema registry
(see [Confluent Schema Registry](http://docs.confluent.io/2.0.1/schema-registry/docs/intro.html))
@@ -171,21 +172,21 @@
it can be used as a nested model.
To extend a model that will be used as a nested model, you must ensure that it
is defined, which will register it, prior it being referenced by another model.
-Using the `Avromatic.on_initialize` option allows models that are extended and
-will be used as nested models to be defined at the end of the `.configure`
-block. In Rails applications, this Proc will also be executed after
+Using the `Avromatic.eager_load_models` option allows models that are extended
+and will be used as nested models to be defined at the end of the `.configure`
+block. In Rails applications, these models are also re-registered after
`nested_models` is cleared when code reloads to ensure that classes load in the
correct order:
```ruby
Avromatic.configure do |config|
- config.on_initialize do
+ config.eager_load_models = [
# reference any extended models that should be defined first
MyNestedModel
- end
+ ]
end
#### Custom Types
Custom types can be configured for fields of named types (record, enum, fixed).