diff --git a/changelog.d/3118-route-model-binding-aside-scope.fixed.md b/changelog.d/3118-route-model-binding-aside-scope.fixed.md new file mode 100644 index 0000000000..434dca1c5b --- /dev/null +++ b/changelog.d/3118-route-model-binding-aside-scope.fixed.md @@ -0,0 +1 @@ +- Corrects the route-model-binding guide: the "silently skips" aside now applies only to convention-derived `binding=true`, where no matching model class is a normal case (health checks, static pages). A new caution under the explicit-name section clarifies that `binding="ModelName"` throws when the named class can't be resolved — a configuration error, not a silent skip. diff --git a/web/sites/guides/src/content/docs/v4-0-0/digging-deeper/route-model-binding.mdx b/web/sites/guides/src/content/docs/v4-0-0/digging-deeper/route-model-binding.mdx index b71656fbe1..4d752a9e5a 100644 --- a/web/sites/guides/src/content/docs/v4-0-0/digging-deeper/route-model-binding.mdx +++ b/web/sites/guides/src/content/docs/v4-0-0/digging-deeper/route-model-binding.mdx @@ -65,6 +65,10 @@ mapper() The singular model name is derived from the controller name: `posts` (controller) → `Post` (model class) → `params.post` (instance key). Binding is skipped for `index`, `new`, and `create` — those actions have no `params.key` to resolve against. + + ## Global default If you want binding turned on everywhere without editing each resource, flip the application-wide default in `config/settings.cfm`: @@ -104,8 +108,8 @@ mapper() `binding="BlogPost"` resolves the `BlogPost` model and stores the instance under `params.blogPost` (the lowercase-initial form of the class name). The `binding` argument accepts `true`, `false`, or a simple string — any non-boolean string is treated as the model class to load. -