在控制器中,我有@users_shown
。在视图中,我使用@users_shown
提供了部分_attendants.html.haml
。为什么渲染一个局部后,@ users_shown是否为零?
没关系,但在这个页面上有一个按钮叫做attend_again
,当你点击这个按钮时,它将通过AJAX渲染局部_attendants.html.haml
。
问题是在部分_attendants.html.haml
,@users_shown
是nil
。我不知道为什么。
文件_attendants.html.haml喜欢这个
- unless @users_shown.blank?
[email protected]_shown.each do |user|
user.name,user.id
你可以给它更多的信息?如果可能,我希望看到ajax调用 – 2012-02-28 04:33:04
$('#page_attendants')。html('<%= escape_javascript(render:partial =>“xxxx/_page_attendants”)%>'); – hlcfan 2012-02-28 04:36:30
其实没有ajax。 – 2012-02-28 04:54:15