I have in my project users and providers.
User has one provider which means in order to be a provider you should sign in as a user first.
I have a navigation bar which has profile link which send the user to his profile view.
But if the user has a provider user, I want the link to redirect to the provider profile page and not to the user one.
Does someone has an idea?
thanks
There are couple of ways to realize that.
First of all you can redirect_to provider_path() in your profile action if user have a provider.
Second way is to check if user.provider in your navigation bar, and then render that link you need (i prefer extract this logic to helper).