导轨设计,没有路线匹配注销

编程入门 行业动态 更新时间:2024-10-07 14:29:22
本文介绍了导轨设计,没有路线匹配注销的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

虽然有很多类似的问题,但我已经搜索了几个小时,但仍然无法解决.

Though there're lots of similar questions, i've searched for it for hours but still can not fix it.

环境导轨 3.0.9红宝石 1.9.2设计 1.4.2

Env rails 3.0.9 ruby 1.9.2 devise 1.4.2

我更改了默认登录网址:

I changed the default login url using:

5 resources :users 6 devise_for :users, :path => "", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }

localhost:3000/login 对我来说很好用但我包括

And the localhost:3000/login works fine for me But I include

= link_to 'sign_out', destroy_user_session_path, :method => :delete

在我的 application.haml 中,单击它后,它说没有路由匹配/logout"为什么?请帮帮我.

in my application.haml, after i click it, it says that no route matchs "/logout" Why? Please help me.

推荐答案

我有一个几乎相同的问题,感谢 SO 很容易解决(链接到我的问题).首先,确保您的布局文件application.html.erb"中有 <%= javascript_include_tag :defaults %>.

I had a nearly identical problem and thanks to SO fixed it quite easily (link to my question). First, make sure you have <%= javascript_include_tag :defaults %> in your layout file "application.html.erb."

然后,在您的配置 -> 初始化程序 -> devise.rb" 文件中确保它显示:

Then, in your config -> initializers -> "devise.rb" file make sure it says:

config.sign_out_via = :delete

和你的sign_out"代码destroy_user_session_path, :method =>:delete 应该可以了.

and your "sign_out" code destroy_user_session_path, :method => :delete should work.

更多推荐

导轨设计,没有路线匹配注销

本文发布于:2023-11-25 21:36:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631436.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:导轨   路线

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!