#55: accessing locals hash within an ActionView partial
Solved!
How do you access the hash of locals you pass into a partial from within that partial?
local_assigns
- kueda on June 19, 2009, 05:06 PM UTC
The variable is named "local_assigns," so you can do something like this:
Kind of useful when you have partials wrapping other, very similar partials.
<% defaults = { :protagonist => 'Romeo', :sidekick => 'Mercutio' } %>
<%= render :partial => "some_other_partial", :locals => defaults.merge(local_assigns) %>
Kind of useful when you have partials wrapping other, very similar partials.