2012-01-26 49 views
2

我有一個ActiveAdmin應用程序。當用戶登錄時,它被認爲是/admin,但我想重定向更改到別的/admin/custom_dashboardsRails 3 ActiveAdmin。如何更改登錄後重定向?

我能夠更改訪問重定向被拒絕錯誤與此

application_controller.rb 
-------------------------- 
rescue_from CanCan::AccessDenied do |exception| 
    redirect_to admin_custom_dashboards_path, :alert => exception.message 
end 

但我想在登錄後改變重定向,我該怎麼做?

回答

2

找到了答案:Redirect to specific URL after logging in

我剛纔添加下列到application_controller.rb

application_controller.rb 
------------------------- 
def after_sign_in_path_for(resource_or_scope) 
    admin_favorite_path # customize to your liking 
end