I am using devise invitable in my application for inviting the users. If the user exists in the database I have to redirect him to signin screen otherwise to the signup screen if he is a new user. Even if I invite the user like:
User.invite!(:email => "[email protected]", :name => "Jonny"), the data is getting entered in the database, then the user is always getting redirected to sign in screen. I had written the following for checking the email in invitations controller:
def edit
if User.exists?(:email => params[:email])
redirect_to new_user_session_path
else
redirect_to new_user_registration_path
end
end
Can some help me how I can handle this situation.