Create A User (Owner) and then Create A Team using Devise
-
26-09-2019 - |
Question
I have been trying for several days using nested attributes, etc. Basically, I want a User to SIGN UP. Once the User is 'Signed Up' I want them to be redirected to 'Create Your Team' page.
Once they created their Team, then they are redirected to their Team Dashboard.
But what if a User didn't create the Team right away? I would like it so the system detects that they have not created a Team and redirects them, otherwise go to Dashboard.
I'm not sure what would be the best practice in doing this. I was hoping to find some Github project for doing this but to no avail.
Thanks
Solution
I would make the controller something like..
def login
unless current_user.exists?(team)
redirect_to create_team
else
redirect_to root_url
end
end
That's so psuedo-code.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow