Merge pull request #52209 from bensheldon/strict-local-assigns-defaults

Document undefined `local_assigns` when using Strict Locals with defaults
This commit is contained in:
Rafael Mendonça França 2024-06-26 16:17:33 -04:00 committed by GitHub
commit 862f402651
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -689,6 +689,16 @@ line in the partial.
CAUTION: Only keyword arguments are supported. Defining positional or block
arguments will raise an Action View Error at render-time.
The `local_assigns` method does not contain default values specified in the
`local:` magic comment. To access a local variable with a default value that
is named the same as a reserved Ruby keyword, like `class` or `if`, the values
can be accessed through `binding.local_variable_get`:
```erb
<%# locals: (class: "message") %>
<div class="<%= binding.local_variable_get(:class) %>">...</div>
```
Layouts
-------