在控制器中,我有@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