2016-04-04 7 views
0

私はUsers::OmniauthCallbacksControllerの中にあり、redirect_to after_sign_in_url_for(@user)を呼び出そうとしていますが、users/がコントローラに追加されています。これをどうやって止めるのですか?スコープ付きコントローラのafter_sign_in_url_for(リソース)

いくつかのデバッグ:

>> after_sign_in_path_for(@user) 
=> {:controller=>"expert_questions", :action=>"index"} 
>> url_for(after_sign_in_path_for(@user)) 
!! #<ActionController::UrlGenerationError: No route matches {:action=>"index", :controller=>"users/expert_questions"}> 

答えて

0

はこの1つを試してみてください:

def after_sign_in_path_for(user) 
    if user.admin 
     '/admin' 
    else 
     '/' 
    end 
    end 
0

あなたは{:controller=>"expert_questions", :action=>"index"}

def after_sign_in_path_for(@user) 
    expert_questions_index_path 
end 
にリダイレクトするURLヘルパーを使用することができます
関連する問題