简体   繁体   中英

How do I redirect devise sign_in path to a different controller and view? Note:This is before the authentication happens

right now in my app users can sign in at /users/sign_in . But I would rather have them sign in and sign up at a same place so i have a view already created at /home/all . That being said, how do I make sure that every time users go to /users/sign_in or /users/sign_up they are redirect to /home/all ?

Thanks

You can do this by overriding the devise's default route,

 get "/users/sign_up" => 'home#all'
 get "/users/sign_in" => 'home#all'

write this to lines in routes file before, devise_for :users .

Whenever request comes from /users/sign_up/ or /users/sign_in/, it will be handled by home#all

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM