4

管理者がログインすると、メインのホームページ (つまり、管理者のダッシュボードではない) に自動的にリダイレクトされます。なぜこれを行うのか、どのように変更するのかわかりません...

ルート.rb

ActiveAdmin.routes(self)

  devise_for :admin_user, ActiveAdmin::Devise.config


  get "guidelines/topic"
  get "guidelines/topichospital"
  get "guidelines/topicspecialty"
  get "guidelines/favourite"
  get "profiles/show"
  get "guidelines/show"

root :to => 'guidelines#index'

私のapplication_controller.rbは、ユーザーログイン後にリダイレクトするように変更されました(ただし、管理者ログインではありません)-これは問題ですか?

include PublicActivity::StoreController
  protect_from_forgery

def after_sign_in_path_for(resource)
 favourites_path
end

hide_action :current_user
4

3 に答える 3

3

私はこれをしなければなりませんでした:

class ActiveAdmin::Devise::SessionsController
  def after_sign_in_path_for(resource)
    admin_dashboard_path
  end
end

問題を修正します。

必要に応じて、カスタマイズの可能性も開きます。

于 2015-04-16T08:00:28.887 に答える
3

Zippie のおかげで答えが見つかりました。admin_controller.rb に以下を追加しました:

def after_sign_in_path_for(resource)
     admin_dashboard
end
于 2013-03-13T01:26:09.740 に答える