我像这样渲染部分视图。
<%= render :partial => 'resources/positions', :controller => 'resources',
:action => 'this_is_a_test',
:locals => {:id_resource => 42} %>
资源控制器.rb
def this_is_a_test
@test1 = "batman"
render :partial => 'positions'
end
_positions.html.erb
<%= @test1 %>
但变量@test1 为空。你有什么主意吗 ?