虽然有很多类似的问题,但我已经搜索了几个小时,但仍然无法解决.
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.
更多推荐
导轨设计,没有路线匹配注销
发布评论