I have a user model that has a few different types, i.e. there is a user attribute that is set as either a usertype1, usertype2, or usertype3. How can I route the user to a different page based on the user type? I am using devise for authentication.
Share
If you want to redirect the user after logging in then check this devise wiki. The specific code is
But if what you’re looking for is more generic then that you probably want to define roles and give users access to certain parts of the site based on their roles – also known as authorization. For that I’d recommend using cancan. You can also watch the railscast episode if you want more info.
Edit:
See also this so question