Ruby On Rails - Devise Redirect Back To The Original Location After Sign In Or Sign Up? - Stack Overflow. I use redirect loop with devise after_sign_in_path_for link for my problem but it does not work for me. Devise provides you a method called authenticate_user!
'registrations' } make sure this appears before your other user routes. Devise_for :users, :controllers => { registrations: I've tried overriding registrationscontroller and i've tried adding an applicationscontroller function like : For now, everything else seems to be working, except the sign up redirect. To learn more, see our tips on writing great. $ sudo gem install rails you can then rerun your rails command. Back them up with references or personal experience. # saves the location before loading each page so we can return to the # right page. For example, if this appears after resources :users, your router may generate an error when you attempt to visit urls such as /users/sign_in, as it will be looking for a user with the id “sign_in”. Devise automatically redirects on sign in and sign up as long as you store the location of the current page using devise's store_location_for(resource).
What happens if your user user cannot access a resource in your application? Def after_sign_in_path_for(resource) if resource.sign_in_count == 1 user_path(resource) else stored_location_for(resource) || users_path end end we are using the numbers of times the users has logged to the system, resource.sign in count , and if this number is 1 it has to be the first time, or in my case, after the user sign_up Was sie tun wollen, ist, keines der vorkompilierten rubine zu verwenden und stattdessen ruby auf ihrem lokalen rechner zu kompilieren, so: I use redirect loop with devise after_sign_in_path_for link for my problem but it does not work for me. You will probably have to store the original path in a session or something before logging them in. If we're on a devise page, we don't want. To get the latest version, simply type: Devise_for :users, :controllers => { registrations: Not sure what else to. I create user model with devise and controller with devise. To learn more, see our tips on writing great.