任何人都可以帮助我吗? 我正在使用带有rails的设计进行身份验证。 我有这些控制器:
Users::RegistrationsController < Devise::RegistrationsController
我使用下面的控制器列出具有不同标准的用户
class UsersController < ApplicationController
以下是我的路线:
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
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
所以我在这里要做的就是让领导者创造用户。但每当我点击新用户表单的提交按钮时,我都会在下面收到此错误。
Routing Error No route matches [POST] "/users/sign_up"
提前感谢您的帮助。
答案 0 :(得分:1)
从 rake路线 o / p可以清楚地看出,发布/用户/ sign_up 未定义。
user_registration POST /users(.:format) users/registrations#create
使用以下路线创建用户。