Closed jpalmieri closed 9 years ago
Redirecting users to /recipes immediately after sign-in makes sense.
Although the WelcomeController#index
redirect may be a bit frustrating for signed in users who genuinely want to view the home page, they won't be able to unless they sign out.
Good point. Maybe creating an About path which points to the same resource (and then adding an About link to the navbar) could be a solution to that.
On Thu, Feb 19, 2015 at 5:53 AM, Eliot Sykes notifications@github.com wrote:
Redirecting users to /recipes immediately after sign-in makes sense.
Although the WelcomeController#index redirect may be a bit frustrating for signed in users who genuinely want to view the home page, they won't be able to.
— Reply to this email directly or view it on GitHub https://github.com/jpalmieri/brewery/pull/23#issuecomment-75054762.
Not sure the about path is ideal, I'd not recommend duplicating the home page on the about page, normally those 2 pages are pretty different in their purpose and content.
Consider keeping this method in application_controller.rb so freshly logged in users are taken to the /recipes
page:
# application_controller.rb
def after_sign_in_path_for(resource)
recipes_path
end
If the redirect is removed from WelcomeController#index
, then logged in users can still see the home page at the root /
path:
# welcome_controller.rb
def index
# Nothing here, don't redirect. Freshly logged in users will still be redirected
# immediately after login thanks to the after_sign_in_path_for method
# in application_controller.rb
end
Trying to improve the user experience :)
Regarding the redirect, I saw people suggesting to conditionally may your root to different resources. That seemed weird to me, so I figured out a different way: http://stackoverflow.com/questions/14416234/devise-redirect-automatically-from-root-url-if-signed-in/28596567#28596567