用设计1.0.7覆盖会话控制器

时间:2012-12-20 20:06:54

标签: ruby-on-rails devise override controllers

我正在尝试在我的会话#destroy action中添加一行代码。我的倾向是用一个继承它的设计控制器来覆盖设计控制器。我对devise_for语法非常熟悉,但是我从设计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"}

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

0 个答案:

没有答案