instance method
local_assigns
Ruby on Rails 7.0.10
Since v5.2.8.1Returns a hash with the defined local variables.
Given this sub template rendering:
<%= render "shared/header", { headline: "Welcome", person: person } %>
You can use local_assigns in the sub templates to access the local variables:
local_assigns[:headline] # => "Welcome"
Source
# File actionview/lib/action_view/template.rb, line 103
eager_autoload do
autoload :Error
autoload :RawFile
autoload :Renderable
autoload :Handlers
autoload :HTML
autoload :Inline
autoload :Sources
autoload :Text
autoload :Types
end
Defined in actionview/lib/action_view/template.rb line 103
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Template