将自定义变量发送给部分 - 中间人

Sending custom variables to partial - middleman

如何通过来自标记的调用将自定义变量发送到局部变量。

<%= partial (:contentHeader, :title=>"Title Goes here") %>
/*trying to send a variable named title with "Title Goes Here" to the partial*/

部分是这样的:

<div class = "contentHeader">
<h2><%=title%></h2>
</div>

所以输出结果应该是

<div class = "contentHeader">
<h2>Title Goes Here</h2>
</div>

使用:locals将变量发送到partial,

<%= partial(:contentHeader, :locals => { :title => "Title Goes here" }) %>