← Back to Upcase

Redirect to a different url after login using Devise

(Scott Hollinshead) #1


I have just started to use devise for authentication, I have it kind of working but I would like it to redirect_to a different url instead of root_path after many hours of googling I haven’t managed to get this working a lot of the posts say to override the after_sigin_in_path_for method in ApplicationController, which I have but my test is still expecting to see “welcome me@example.com” when it should be yelling that products_path does not exist meaning it is not redirecting after a login.

def after_sign_in_path_for(resource)

(Luís Ferreira) #2

I think it’s after_sign_in_path_for

(Scott Hollinshead) #3

I made a very silly mistake and forgot to add click_button 'Login' to my test, therefore not actually doing anything, the above method does work.


(Jon Seidel) #4

Not to worry, @scott… I’ve made my share of silly mistakes :=). That’s why it’s great to have a place like this to get support.