#55: accessing locals hash within an ActionView partial

How do you access the hash of locals you pass into a partial from within that partial?


The variable is named "local_assigns," so you can do something like this:

<% 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.

Think you've got a better solution? Help 148c663fd665c53518538e093ce3c2ab_small kueda out by posting your solution