Ruby on rails Rails在响应时出错
我为学习Rails创建了一个简单的用户身份验证:Ruby on rails Rails在响应时出错,ruby-on-rails,ruby-on-rails-3,authentication,respond-to,Ruby On Rails,Ruby On Rails 3,Authentication,Respond To,我为学习Rails创建了一个简单的用户身份验证: class UsersController < ApplicationController def new @user = User.new end def create respond_to do |format| if @user.save format.hmtl {redirect_to root_url} else f
class UsersController < ApplicationController
def new
@user = User.new
end
def create
respond_to do |format|
if @user.save
format.hmtl {redirect_to root_url}
else
format.hmtl {render 'new'}
end
end
end
附言:我想要respond_to和format,因为在我想要添加format.json方法之后
谢谢您有一个打字错误-将
格式.hmtl
更改为格式.html
对不起,我不明白我必须更改什么…您能解释一下吗?在您的代码中,您将字母html
与hmtl
混在一起了-当然,这不是您要找的mime类型。除非您使用的是超标记文本语言。。。
Completed 500 Internal Server Error in 218ms
NameError (uninitialized constant Mime::HMTL):
app/controllers/users_controller.rb:16:in `block in create'
app/controllers/users_controller.rb:14:in `create'