我的js.erb文件中有以下内容:
$('#menu').after($("<%=escape_javascript(render 'boards/customize', :board => @board, :templates => @templates, :types => @types)%>")
所以我尝试将一些本地人传递给我的部分
在我的_customize.html.erb
中<div id="customize">
<ul id="categories">
<% @types.each do |type|%>
<li><%=link_to type.name, change_type_board_path(board, :type_id => type.id), :remote => true %></li>
<% end %>
</ul>
<div id='carousel'>
<%=render 'boards/carousel', :templates => templates %>
</div>
</div>
I get the following error:
undefined local variable or method
board'代表#&lt;#:0x00000103893e48`&gt;
你应该如何将这些变量传递给Rails中的部分?
答案 0 :(得分:1)
在Rails 3中:
render :partial => 'boards/customize',
:locals => { :board => @board , :templates => @templates, :types => @types }