When passing local variables to sub-templates, the variables can be accesses using local_assigns. This part of the documentation was removed in the commit 3dfcae6.
In earlier versions, defined? foo did not work reliably, so local_assigns was the recommended way to check if a local variable has beed defined. Now defined? works, and can be used safely, but local_assigns is still available and useful in some scenarios, such as:
Headline: <%= defined?(headline) ? headline : '' %>
Headline: <%= local_assigns[:headlines] %>
This was also brought up by @dhh in another issue today: #18962. It's especially confusing since the only mention of local_assigns was removed from the documentation even though the feature is still available. I've written up more about this here.
Add documentation for local_assigns [ci skip]
There's another PR on the same topic #15700
👍, instead of if defined(some_flag) && some_flag, I can do if local_assigns[:some_flag]
if defined(some_flag) && some_flag
good to see this is merged 👍