Failed to check Devise on the same URL?

I'm trying to do this. Use my own route when model validation fails using Devise , and I'm out of luck.

I have my routes listed as follows:

# authentication routing
devise_for :users do
  get "/login" => "devise/sessions#new"
  get "/logout" => "devise/sessions#destroy"
  get "/register" => "devise/registrations#new"
end

But when the check fails, say on the page /register, the URL will change to /users.

I want the url to stay /registerwhen validation fails. How should I do it?

+3
source share
1 answer

Balls. Again, I figure it out a few minutes after posting - do you know this? - read.

URL Rails3 https://github.com/plataformatec/devise/wiki/How-To:-Change-the-default-sign_in-and-sign_out-routes, :

# authentication routing
devise_for :users, :controllers => { :sessions => 'devise/sessions' }, :skip => [:sessions] do
  get "/login" => "devise/sessions#new", :as => :new_user_session
  post "/login" => "devise/sessions#create", :as => :user_session
  get "/logout" => "devise/sessions#destroy", :as => :destroy_user_session
  get "/register" => "devise/registrations#new", :as => :new_user_registration
  post "/register" => "devise/registrations#create", :as => :user_registration
end

, .

+4

All Articles