Reputation: 102
Can anyone please help me? I am using devise with rails for the authentication. I have these controllers:
Users::RegistrationsController < Devise::RegistrationsController
I use this controller below to list the users with different criteria
class UsersController < ApplicationController
Below is my routes:
devise_for :users,
:controllers => {
:registrations => "users/registrations"
}
resources :users, :only => [:index, :show, :mentor_list] do
collection do
get 'leaders' => 'users#leaders_list'
get 'mentors' => 'users#mentors_list'
get 'students' => 'users#students_list'
end
resources :addresses
end
below are my rake routes result:
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
PATCH /users/password(.:format) devise/passwords#update
PUT /users/password(.:format) devise/passwords#update
cancel_user_registration GET /users/cancel(.:format) users/registrations#cancel
user_registration POST /users(.:format) users/registrations#create
new_user_registration GET /users/sign_up(.:format) users/registrations#new
edit_user_registration GET /users/edit(.:format) users/registrations#edit
PATCH /users(.:format) users/registrations#update
PUT /users(.:format) users/registrations#update
DELETE /users(.:format) users/registrations#destroy
leaders_users GET /users/leaders(.:format) users#leaders_list
mentors_users GET /users/mentors(.:format) users#mentors_list
students_users GET /users/students(.:format) users#students_list
user_addresses GET /users/:user_id/addresses(.:format) addresses#index
POST /users/:user_id/addresses(.:format) addresses#create
new_user_address GET /users/:user_id/addresses/new(.:format) addresses#new
edit_user_address GET /users/:user_id/addresses/:id/edit(.:format) addresses#edit
user_address GET /users/:user_id/addresses/:id(.:format) addresses#show
PATCH /users/:user_id/addresses/:id(.:format) addresses#update
PUT /users/:user_id/addresses/:id(.:format) addresses#update
DELETE /users/:user_id/addresses/:id(.:format) addresses#destroy
users GET /users(.:format) users#index
user GET /users/:id(.:format) users#show
root GET / users#index
so what i am trying to do here is to let the leader creates users. But whenever I click on the submit button of the new User form I get this error below.
Routing Error No route matches [POST] "/users/sign_up"
Thanks in advance for helping.
Upvotes: 0
Views: 2460
Reputation: 10025
It's clear from your rake routes o/p that Post /users/sign_up is not defined.
user_registration POST /users(.:format) users/registrations#create
use the following route to create users.
Upvotes: 1