Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/52.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails在响应时出错_Ruby On Rails_Ruby On Rails 3_Authentication_Respond To - Fatal编程技术网

Ruby on 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

我为学习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
           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'