1

我正在尝试在我的 sessions#destroy 操作中添加一行代码。我的倾向是用一个从它继承的控制器来覆盖设计控制器。我对 devise_for 语法非常熟悉,但我从 devise 1.0.7 得到这些结果。

map.devise_for :users, :controllers => {:sessions => 'facebook_cookie'}

                         new_user_session GET    /users/sign_in                                                        {:controllers=>{:sessions=>"facebook_cookie"}, :action=>"new", :controller=>"sessions"}
                             user_session POST   /users/sign_in                                                        {:controllers=>{:sessions=>"facebook_cookie"}, :action=>"create", :controller=>"sessions"}
                     destroy_user_session GET    /users/sign_out                                                       {:controllers=>{:sessions=>"facebook_cookie"}, :action=>"destroy", :controller=>"sessions"}
                        new_user_password GET    /users/password/new(.:format)                                         {:action=>"new", :controller=>"passwords"}


map.devise_for :users, :controllers => {:sign_out => 'facebook_cookie'}

                         new_user_session GET    /users/sign_in                                                        {:controllers=>{:sign_out=>"facebook_cookie"}, :action=>"new", :controller=>"sessions"}
                             user_session POST   /users/sign_in                                                        {:controllers=>{:sign_out=>"facebook_cookie"}, :action=>"create", :controller=>"sessions"}
                     destroy_user_session GET    /users/sign_out                                                       {:controllers=>{:sign_out=>"facebook_cookie"}, :action=>"destroy", :controller=>"sessions"}
                        new_user_password GET    /users/password/new(.:format)                                         {:action=>"new", :controller=>"passwords"}


map.devise_for :users, :controller => 'facebook_cookie'

                        new_user_session GET    /users/sign_in                                                        {:action=>"new", :controller=>"sessions"}
                             user_session POST   /users/sign_in                                                        {:action=>"create", :controller=>"sessions"}
                     destroy_user_session GET    /users/sign_out                                                       {:action=>"destroy", :controller=>"sessions"}
                        new_user_password GET    /users/password/new(.:format)                                         {:action=>"new", :controller=>"facebook_cookie"}


map.devise_for :users, :controller => {:sessions => 'facebook_cookie'}

                         new_user_session GET    /users/sign_in                                                        {:action=>"new", :controller=>"sessions"}
                             user_session POST   /users/sign_in                                                        {:action=>"create", :controller=>"sessions"}
                     destroy_user_session GET    /users/sign_out                                                       {:action=>"destroy", :controller=>"sessions"}
                        new_user_password GET    /users/password/new(.:format)                                         {:action=>"new", :controller=>"sessionsfacebook_cookie"}

似乎当我指定 :controller 时,它会影响我所有的设计控制器,除了我关心的那个(我从粘贴中省略了其余部分)。另一方面,当我指定 :controllers 时,它只会影响 SessionsController 的路由 - 但它会添加无用的参数而不是覆盖路由。

4

0 回答 0