README_V3.md in schemacop-3.0.11 vs README_V3.md in schemacop-3.0.12
- old
+ new
@@ -1339,11 +1339,12 @@
Finally, Schemacop features the possibility to specify schemas in seperate
files. This is especially useful is you have schemas in your application which
are used multiple times throughout the application.
For each schema, you define the schema in a separate file, and after loading the
-schemas, you can reference them in other schemas.
+schemas, you can reference them in other schemas. The schema can be retrieved
+by using the file name, e.g. `user` in the example `app/schemas/user.rb` below.
The default load path is `'app/schemas'`, but this can be configured by setting
the value of the `load_paths` attribute of the `Schemacop` module.
Please note that the following predescence order is used for the schemas:
@@ -1356,11 +1357,11 @@
* local schemas: Defined by using the DSL method `scm`
* context schemas: Defined in the current context using `context.schema`
* global schemas: Defined in a ruby file in the load path
-### Rails applications
+### External schemas in Rails applications
In Rails applications, your schemas are automatically eager-loaded from the load
path `'app/schemas'` when your application is started, unless your application
is running in the `DEVELOPMENT` environment. In the `DEVELOPMENT` environment,
schemas are loaded each time when they are used, and as such you can make changes
@@ -1383,11 +1384,11 @@
end
end
```
```ruby
-# app/schemas/nested/user.rb
+# app/schemas/nested/group.rb
schema :hash do
str! :name
end
```
@@ -1407,10 +1408,10 @@
schema.validate!({usr: {first_name: 'Joe', last_name: 'Doe', groups: [{name: 'foo'}, {name: 'bar'}]}})
# => {"usr"=>{"first_name"=>"Joe", "last_name"=>"Doe", "groups"=>[{"name"=>"foo"}, {"name"=>"bar"}]}}
```
-### Non-Rails applications
+### External schemas in Non-Rails applications
Usage in non-Rails applications is the same as with usage in Rails applications,
however you might need to eager load the schemas yourself:
```ruby