I have two different types of users (Admin, Teacher). Admin has entire permission to view all, so when he tries to login a page and it should land to 'home#index' page. When Teacher tries to login it should land to 'localhost:3000/post/new' instead of 'home#index'
Routes file contain:
resources :session, :only => [:update]
match 'login' => 'user_sessions#new', :as => :login
match 'logout' => 'user_sessions#destroy', :as => :logout
root to: 'home#index'
So, how do i switch the login page for users of type Teacher 'home#index' to land on a different page ?
Is there a compelling reason you can’t just add a conditional to your index action that redirects if the incoming user is a Teacher?
Something like that? Seems like it’d be easier than screwing around with routes.