Pat*_*nor 9 ajax jquery devise ruby-on-rails-3
经过多次反复试验,我已将问题缩小到下面第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)
Pat*_*nor 16
非常感谢Devise Google Group的Brandon Martin指出我正确的方向......
这是Rails 3.0.4安全修复程序的结果.
http://weblog.rubyonrails.org/2011/2/8/csrf-protection-bypass-in-ruby-on-rails
经过一个小时左右的博客文章,这里有一些提示给别人...
rake rails:update
(我想,但我使用自定义的rails.js文件)csrf_meta_tag
助手放在你javascript_include_tag
的上方希望有所帮助!
归档时间: |
|
查看次数: |
3671 次 |
最近记录: |