README.md in avromatic-0.10.0.rc1 vs README.md in avromatic-0.10.0

- old
+ new

@@ -39,10 +39,14 @@ `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 + `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. #### 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)) @@ -167,12 +171,22 @@ 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. -With Rails for example, it may be necessary to reference in an initializer -models that are extended and will be used as nested models so that classes load -in the correct order. +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 +`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 + # 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). These customizations are registered on the `Avromatic` module. Once a custom type