意图
我已经创建了一个用户模型,如设计文档所示。后来,我搭建了一个控制器和视图,以便有一个索引和一个可视化界面来处理我的用户。
问题
访问edit_user_path 后,我向数据库提交了一个新用户,SQLite 添加了记录(因此正在保存信息),但是发生了一些事情,我没有被重定向到根目录,而是得到一个异常:
ActionController::UnknownFormat in Devise::RegistrationsController#create
Run Code Online (Sandbox Code Playgroud)
如何修复此异常并使 Rails 流向 root_path?
在这里,我向您添加文件,以便您可以辨别发生了什么:
路由文件
#RESTful routes
devise_for :users
resources :users, :except => [:create]
resources :clans
resources :games
resources :matches
#Root and debug
root :to => 'debug#features'
Run Code Online (Sandbox Code Playgroud)
耙路线
Prefix Verb URI Pattern Controller#Action
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) evise/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) devise/registrations#cancel
user_registration …Run Code Online (Sandbox Code Playgroud)