Archive

Posts Tagged ‘partials’

Passing parameters to a partial

August 19, 2009 2 comments

Hi,

This is just a quick post about how to pass parameters to rails partials. (As most of you all know, partials are lightweight than components) and personally I’m using it in my project as headers and footers.

But if we are to pass some parameters to the partial how to do that ?? its simple as this

render :partial => “<partial name>”, :locals => { :param1 => “value”}

<partial name> – name of your partial (Ex /partials/footer)

:params1 – parameter name

“value” – value

Its quick and simple 🙂


Advertisements
Categories: Ruby Rails Tags: , ,