[英]Rails Bootstrap Gem on Top of Devise
I'm fairly new to rails and much of the devise login system has been generated for me. 我对rails非常陌生,并且为我生成了很多设计登录系统。 However, I tested my application before my twitter-bootstrap gem was applied, and a button I am concerned with now was previously correctly sending DEL requests.
但是,我在应用twitter-bootstrap gem之前测试了我的应用程序,而我现在关注的一个按钮以前正确地发送了DEL请求。
However, it is now sending GET requests 但是,它现在正在发送GET请求
HTML looks like HTML看起来像
<li>
<a href="/users/logout" data-method="delete" rel="nofollow">Logout</a>
</li>
I'm still fairly new to the bootstrap gem, so I was wondering if the gem was dynamically changing some of the HTML? 我仍然是引导宝石的新手,所以我想知道宝石是否动态地改变了一些HTML? or why my tag clearly
says data-method="delete"
but still causes a GET request? 或者为什么我的标签清楚地
says data-method="delete"
但仍然会导致GET请求?
My Error: 我的错误:
No route matches [GET] "/users/logout"
Source: https://github.com/seyhunak/twitter-bootstrap-rails
Before beginning, I've copied sth from here . 在开始之前,我已经从这里复制过了 。 First, there's no route for
users/logout
in Devise as default. 首先,默认情况下,Devise中没有
users/logout
路由。 It is defined as /users/sign_out
default. 它定义为
/users/sign_out
默认值。 You could change it on routes.rb
under config
. 您可以在
config
下的routes.rb
上更改它。 Instead of that, I'd like to offer this code to paste on your view file: 而不是那样,我想提供这段代码来粘贴你的视图文件:
<li>
<%= link_to "Sign out", destroy_user_session_path, :method => :delete %>
</li>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.