Deviseをいじいじしたあと、サインアップを試みるとこんなエラーが...
AbstractController::DoubleRenderError in Users::SessionsController#create
Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and at most once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like "redirect_to(...) and return".
解決方法
Devise: コントローラのオーバライドでredirect_toを使わない
- 原因となった箇所
def after_sign_up_path_for
redirect_to users_path
end
- 修正
def after_sign_up_path_for
users_path
end
理由
redirect_to users_path
# deviseの仕様上、上記の記述は以下と同義となってしまうから
redirect_to(redirect_to(users_path))