diff --git a/content/v2.0/app/app-config.md b/content/v2.0/app/app-config.md index a2115d50..86f6069a 100644 --- a/content/v2.0/app/app-config.md +++ b/content/v2.0/app/app-config.md @@ -62,7 +62,7 @@ Sets the keys for the app components to be automatically imported into each slic ### `no_auto_register_paths` -Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.0/app/container-and-components) for more detail. +Sets an array of paths to be excluded from component auto-registration. Defaults to `["entities"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.0/app/slices). See the [containers and components guide](/v2.0/app/container-and-components) for more detail. ## Router diff --git a/content/v2.0/app/container-and-components.md b/content/v2.0/app/container-and-components.md index 62e2c255..a9b49116 100644 --- a/content/v2.0/app/container-and-components.md +++ b/content/v2.0/app/container-and-components.md @@ -324,7 +324,7 @@ end If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration. -Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container: +Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container: ```ruby # config/app.rb @@ -333,11 +333,16 @@ require "hanami" module Bookshelf class App < Hanami::App - config.no_auto_register_paths << "structs" + config.no_auto_register_paths << "values" end end ``` +The default value for `no_auto_register_paths` is `["entities"]`. + +These apply for the root of the application, as well within any [slices](/v2.0/app/slices) +Additionally, the `config/` directory within a slice is always excluded from auto-registration. + A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project. For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container: diff --git a/content/v2.1/app/app-config.md b/content/v2.1/app/app-config.md index 5e11674c..f3f7cd47 100644 --- a/content/v2.1/app/app-config.md +++ b/content/v2.1/app/app-config.md @@ -62,7 +62,7 @@ Sets the keys for the app components to be automatically imported into each slic ### `no_auto_register_paths` -Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.1/app/container-and-components) for more detail. +Sets an array of paths to be excluded from component auto-registration. Defaults to `["entities"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.1/app/slices). See the [containers and components guide](/v2.1/app/container-and-components) for more detail. ## Router diff --git a/content/v2.1/app/container-and-components.md b/content/v2.1/app/container-and-components.md index 69f00aec..521abd92 100644 --- a/content/v2.1/app/container-and-components.md +++ b/content/v2.1/app/container-and-components.md @@ -324,7 +324,7 @@ end If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration. -Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container: +Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container: ```ruby # config/app.rb @@ -333,11 +333,16 @@ require "hanami" module Bookshelf class App < Hanami::App - config.no_auto_register_paths << "structs" + config.no_auto_register_paths << "values" end end ``` +The default value for `no_auto_register_paths` is `["entities"]`. + +These apply for the root of the application, as well within any [slices](/v2.1/app/slices) +Additionally, the `config/` directory within a slice is always excluded from auto-registration. + A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project. For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container: diff --git a/content/v2.2/app/app-config.md b/content/v2.2/app/app-config.md index 9703906c..34e5c5fc 100644 --- a/content/v2.2/app/app-config.md +++ b/content/v2.2/app/app-config.md @@ -62,7 +62,8 @@ Sets the keys for the app components to be automatically imported into each slic ### `no_auto_register_paths` -Sets an array of paths (relative to the root of the app or any slice) to be excluded from component auto-registration. Defaults to `["entities"]`. See the [containers and components guide](/v2.2/app/container-and-components) for more detail. +Sets an array of paths to be excluded from component auto-registration. Defaults to `["db", "entities", "relations", "structs"]`. Note that files in `lib/` are always excluded from auto-registration, too. These paths are all relative to the root of the app or any [slice](/v2.2/app/slices). See the [containers and components guide](/v2.2/app/container-and-components) for more detail. + ## Router diff --git a/content/v2.2/app/container-and-components.md b/content/v2.2/app/container-and-components.md index ab019d95..6100028e 100644 --- a/content/v2.2/app/container-and-components.md +++ b/content/v2.2/app/container-and-components.md @@ -324,7 +324,7 @@ end If you have a whole class of objects that shouldn't be placed in your container, you can configure your Hanami application to exclude an entire directory from auto registration by adjusting its `no_auto_register_paths` configuration. -Here for example, the `app/structs` directory is excluded, meaning nothing in the `app/structs` directory will be registered with the container: +Here for example, the `app/values` directory is excluded, meaning nothing in the `app/values` directory will be registered with the container: ```ruby # config/app.rb @@ -333,11 +333,17 @@ require "hanami" module Bookshelf class App < Hanami::App - config.no_auto_register_paths << "structs" + config.no_auto_register_paths << "values" end end ``` +Note that the default value for `no_auto_register_paths` is `["db", "entities", "relations", "structs"]`, +so you do not need to specify those. Also, be sure to append to that list. + +These apply for the root of the application, as well within any [slices](/v2.2/app/slices) +Additionally, the `config/` directory within a slice is always excluded from auto-registration. + A third alternative for classes you do not want to be registered in your container is to place them in the `lib` directory at the root of your project. For example, this `SlackNotifier` class can be used anywhere in your application, and is not registered in the container: