We are trying to route a new user to fill out a Fact Sheet on their first login and then land on their Dashboard the rest of the time.
Going on this post here: devise first login with rails
We added this to our application controller:
def
after_sign_in_path_for(user)
redirect_to ((current_user.sign_in_count == 0) ? new_fact_sheet_path : dashboard_index_path )
end
But we get this error:
"AbstractController::DoubleRenderError in Devise::RegistrationsController#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".
We thought we were overriding Devise default routing with a redirect in the application controller?
Solution: This ended up being a two-part solution as noted in comments below. Code that worked:
def
after_sign_in_path_for(user)
((current_user.sign_in_count == 1) ? new_fact_sheet_path : dashboard_index_path )
end