我像这样渲染一个部分:
<%= render :partial => 'widgets/some_partial, :locals => {:foo => 'bar'} %>
所以在里面_some_partial.html.erb
我渲染了两个像这样的局部:
<% #foo.nil? #=> false %>
<%= render :partial => 'widgets/another_partial', :locals => {:foo => foo} %>
`<%= render :partial => 'widgets/another_partial_again', :locals => {:foo => foo} %>`
foo 局部变量some_partial.html.erb
在another_partial_again.html.erb
. 但是,another_partial.html.erb
即使我在渲染调用中明确传递了 foo 变量,也无法访问它。
这里发生了什么?
谢谢您的帮助。