[英]Routing Error Active Admin and Devise
When trying to access Active Admin dashboard under http://localhost:3000/admin
I get redirected to http://localhost:3000/users/sign_in
. 当尝试访问
http://localhost:3000/admin
下的Active Admin仪表板时,我被重定向到http://localhost:3000/users/sign_in
。 However my path shows the /admin
path. 但是,我的路径显示了
/admin
路径。
admin_root_path GET /admin(.:format) admin/dashboard#index
admin_dashboard_path GET /admin/dashboard(.:format) admin/dashboard#index
batch_action_admin_users_path POST /admin/users/batch_action(.:format) admin/users#batch_action
admin_users_path GET /admin/users(.:format) admin/users#index
and 和
new_user_session_path GET /users/sign_in(.:format) devise/sessions#new
user_session_path POST /users/sign_in(.:format) devise/sessions#create
Anyone know why this is happening? 有人知道为什么会这样吗?
EDIT 编辑
routes.rb routes.rb
Myapp::Application.routes.draw do
ActiveAdmin.routes(self)
devise_for :users, :controllers => { :omniauth_callbacks => "users/omniauth_callbacks" }
root 'static_pages#home'
match '/help', to: 'static_pages#help', via: 'get'
match '/about', to: 'static_pages#about', via: 'get'
match '/contact', to: 'static_pages#contact', via: 'get'
What is your routes.rb
file looks like? 您的
routes.rb
文件是什么样的? The routes are loaded in the priority from top to bottom, that's why it's important that you place them in correct order. 路由从上到下按优先顺序加载,这就是为什么按正确顺序放置它们很重要。
Generally, ActiveAdmin routes should be loaded after Devise. 通常,ActiveAdmin路由应在Devise之后加载。
devise_for :admin_users, ActiveAdmin::Devise.config
ActiveAdmin.routes(self)
Try to move ActiveAdmin.routes(self)
route to the very bottom (below standard root to:) 尝试将
ActiveAdmin.routes(self)
路由移至最底部(在标准根目录下方:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.