我的 Rails 版本是 3.2.12。我使用以下命令来创建用户身份验证:
rails generate devise:install
rails generate devise users
rake db:migrate
以下是我的路线
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
但是即使用户电子邮件和密码保存在数据库中,我仍然无法注册新用户或登录应用程序。以下是我得到的错误:
NameError in Devise::RegistrationsController#create
uninitialized constant Model
我可能错在哪里?