Is there any easy way to disable devise sign_up page? I have forms for registration and authorization on one page so i don't need any other pages. I want to disable routes responsible for these pages, so that if a user enters users/sign_up
he should't get to the sign up page but should be redirected to some other page.
Asked
Active
Viewed 2,408 times
3

roman
- 5,100
- 14
- 44
- 77
-
Did you find a solution to this? Did you change the `respond_with`? – Ashitaka Mar 29 '12 at 00:45
-
@Ashitaka Finally i skipped all devise default routes and specified a list of `post` and `get` routes mapped to devise controllers. Then i overrided devise controllers to use `respond_with({}, :location => after_sign_up_fails_path_for(resource))` when authentication or registration or password restore fails. Note that you have to create a method `after_sign_up_fails_path_for(resource)`. Inside it just put where you want to go(for_example `home_path`). That worked for me. – roman Mar 29 '12 at 11:19
1 Answers
2
You can overwrite the registrations controller and make the new
action redirect somewhere. Here are some responses to a similar question that was posted on StackOverflow which explain the necessary steps.
-
1#Batkins, `clean_up_passwords resource; respond_with resource` This code is executed when there are errors during registration(ex. a user exists, empty email). If i write `redirect_to some_path` after this code i get double render exception. If i write `redirect_to some_path` instead of `respond_with resource` i am redirected but `devise_error_messages` are empty so i can't use them in the view i'm redirected to. Is there any way to make error messages available in the view i'm redirected to? – roman Feb 16 '12 at 17:10
-
You need to use `redirect_to some_path and return`. That will make it stop executing code within that method after the redirect code occurs which will prevent other render/redirect statements that might occur afterwards. [Read this documentation on the RoR official site](http://guides.rubyonrails.org/layouts_and_rendering.html#avoiding-double-render-errors) for a more detailed explanation. – Batkins Feb 16 '12 at 19:35