We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
local_assigns
1 parent 3accb8d commit fe03a19Copy full SHA for fe03a19
guides/source/action_view_overview.md
@@ -689,6 +689,16 @@ line in the partial.
689
CAUTION: Only keyword arguments are supported. Defining positional or block
690
arguments will raise an Action View Error at render-time.
691
692
+The `local_assigns` method does not contain default values specified in the
693
+`local:` magic comment. To access a local variable with a default value that
694
+is named the same as a reserved Ruby keyword, like `class` or `if`, the values
695
+can be accessed through `binding.local_variable_get`:
696
+
697
+```erb
698
+<%# locals: (class: "message") %>
699
+<div class="<%= binding.local_variable_get(:class) %>">...</div>
700
+```
701
702
Layouts
703
-------
704
0 commit comments