[英]DEVISE - No route matches [GET] “/users/sign_out” - Rails 4
Nothing on the internet solved this problem. 互联网上没有任何东西可以解决这个问题。
I'm running on Rails 4.2.3 and Ruby 2.1.5 After an installation of devise, I got this error. 我在Rails 4.2.3和Ruby 2.1.5上运行。安装了devise之后,出现了此错误。
When I delete the line <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %
from my layout file, the error is gone and everyting looks fine. 当我从布局文件中删除行
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %
,错误消失了,一切看起来都很好。
I tried everything found on stackoverflow, didn't work. 我尝试了在stackoverflow上找到的所有内容,但没有成功。
Right now: 马上:
I use <%= link_to "sign out", destroy_user_session_path, method: :delete %>
in my layout. 我在布局中使用
<%= link_to "sign out", destroy_user_session_path, method: :delete %>
。
I tried to change the initializer : config.sign_out_via = :delete
to "get" also, didn't work. 我试图将初始化程序:
config.sign_out_via = :delete
也更改为“ get”,但是没有用。 Now remains "delete". 现在仍然是“删除”。 Anyway it should be delete in my opinion.
无论如何,我认为应该删除它。
My application.js file includes : //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree .
我的application.js文件包括:
//= require jquery //= require jquery_ujs //= require turbolinks //= require_tree .
Routes.rb file includes devise_for :users, path_names: {sign_in: "login", sign_out: "logout"}
. Routes.rb文件包括
devise_for :users, path_names: {sign_in: "login", sign_out: "logout"}
。 If I don't add this line, it's not working also. 如果我不添加这一行,那么它也无法正常工作。
If I delete <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %
from my layout file it's working. 如果我从布局文件中删除
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %
,则它正常工作。 If I don't, it's not working. 如果我不这样做,那是行不通的。
What is the problem with this javascript thing? 这是什么JavaScript问题? Any opinion is welcome.
欢迎任何意见。
Try using the jquery-turbolinks gem and modify your application.js to look like this: 尝试使用jquery-turbolinks gem并修改application.js使其看起来像这样:
//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require_tree .
//= require turbolinks
Ok the problem seems like because of Windows. 好的,问题似乎是因为Windows。 The solution is adding the gemfile :
'coffee-script-source', '1.8.0'
and bundle update coffee-script-source
This solved. 解决方案是添加gemfile:
'coffee-script-source', '1.8.0'
并bundle update coffee-script-source
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.