Reputation: 515
Im new to rails and im having troubles figuring out the routing in rails 3 with devise
When i rout to the users page i get this ugly error : http://s9.postimage.org/nlyxhlk5b/Devise_routing.png
in my routes i have
#Resources for users
devise_for :users, :controllers => { :registrations => "registrations" }
resource :users do
get 'welcome'
end
These are my user routes
UPDATED
root / members#welcome
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
new_user_password GET /users/password/new(.:format) devise/passwords#new
edit_user_password GET /users/password/edit(.:format) devise/passwords#edit
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) devise/registrations#cancel
user_registration POST /users(.:format) devise/registrations#create
new_user_registration GET /users/sign_up(.:format) devise/registrations#new
edit_user_registration GET /users/edit(.:format) devise/registrations#edit
PUT /users(.:format) devise/registrations#update
DELETE /users(.:format) devise/registrations#destroy
Should i maybe not have 2 user resources ? i believe they might be conflicting somehow or am i just missing something ?
UPDATE
I forgot to mention that i am overriding the default devise registration controller
class RegistrationsController < Devise::RegistrationsController
protected
# Redirect to welcome page after a successful registration
def after_sign_up_path_for(resource)
'/users/welcome'
end
end
Upvotes: 0
Views: 216
Reputation: 15374
Delete the user controller Delete the registrations controller
remove
resource :users do
get 'welcome'
end
add this to your routes
# Directing the user after login
authenticated :user do
root :to => 'recipes#index'
end
change
devise_for :users, :controllers => { :registrations => "registrations" }
To
devise_for :users
Let me know how that goes
Upvotes: 1