经过多次反复试验,我已将问题缩小到下面第5行.出于某种原因,.js响应正在结束用户会话.使用3.0.4并设计1.1.7(和jQuery 1.5).
此外,正在更新@organization并在日志中显示Completed 200 OK,因此在尝试下一个操作之前,用户不知道他/她已注销.
非常感谢任何帮助和指导.
*Controller*
1 def make_featured
2 @organization = Organization.find(params[:id])
3 @organization.is_featured ? @organization.update_attribute(:is_featured,"false") : @organization.update_attribute(:is_featured,"true")
4 respond_to do |format|
5 format.js {render :action => "update", :layout => false}
6 end
7 end
Run Code Online (Sandbox Code Playgroud)
和
*update.js.haml*
$("#organization_" + "#{@organization.id}" ).replaceWith("#{ escape_javascript(render :partial => 'users/supplier_view', :locals => {:organization => @organization}) }");
Run Code Online (Sandbox Code Playgroud)