2
在一個軌道3的應用程序,我有以下途徑定義爲:omniauth +設計「用戶/認證/ Facebook的」魔法路線問題
devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks", :registrations => 'registrations'}, :path_names => { :sign_in => 'login', :sign_out => 'logout' } do
get 'login' =>'devise/sessions#new', :as => :new_user_session
post 'login' => 'devise/sessions#create', :as => :user_session
get 'signup' => 'registrations#new', :as => :new_user_registration
get 'signout' => 'devise/sessions#destroy', :as => :destroy_user_session
end
# catchall route to deal with routing errors
match "*path" => "error#index"
不過,現在當我去登錄/用戶/認證/臉譜,它的路線我的錯誤頁面...
我對這個解決方案是限制添加到最後一場比賽:
match "*path" => "error#index", :constraints => lambda {|req| !req.path.starts_with?("https://stackoverflow.com/users/auth/") }
這工作,但我想知道是否有更好的辦法。 ..?
使用靜態錯誤頁面不會讓你做的事情,如添加泛音,並註明您的應用程序佈局......是的,狀態代碼包含在控制器動作的渲染調用。 – patrick
恰好碰到了這種方法:http://railsapi.com/doc/rails-v3.0.8rc1/classes/ActiveSupport/Rescuable/ClassMethods.html#M007459你應該能夠趕上RecordNotFound。 – agmcleod