我在我的 Devise 应用程序中输入新的电子邮件、密码和密码确认。当我去实际进行注册时,我收到以下错误:
路由错误
No route matches [POST] "/users/sign_up"
尝试跑步
rake routes
以获取有关可用路线的更多信息。
它看起来像new_registration_path
带你去users/sign_up
,它不知道(至少在获得 POST 时)。我如何让它认识到这一点?
下面是一些相关的代码。
这是(可能)相关的routes.rb
:
devise_for :users
resources :users
这是输出rake routes
:
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
static_pages_home GET /static_pages/home(.:format) static_pages#home
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
businesses GET /businesses(.:format) businesses#index
POST /businesses(.:format) businesses#create
new_business GET /businesses/new(.:format) businesses#new
ed it_business GET /businesses/:id/edit(.:format) businesses#edit
business GET /businesses/:id(.:format) businesses#show
PUT /businesses/:id(.:format) businesses#update
DELETE /businesses/:id(.:format) businesses#destroy
root / static_pages#home
这是registrations/new.html.erb中的表格:
<%= form_for(resource, :as => resource_name, :url => new_registration_path(resource_name)) do |f| %>
...
<% end %>