1

i have create a simple user authentication for learning 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

If i create a new user without the block respond_to and format.html all works fine (in the db i have the created user and the page is redirected). With this code, the user is created but i have the following error (and i don't have the redirection):

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'

P.S: i want the respond_to and format because after i want add the format.json method

Thanks

Tom
  • 4,007
  • 24
  • 69
  • 105

1 Answers1

2

You have a typo - change format.hmtl to format.html

PinnyM
  • 35,165
  • 3
  • 73
  • 81
  • sorry i don't have understand what i must change...can u explain it please? – Tom Apr 04 '13 at 16:33
  • 1
    In your code, you have mixed up the letters `html` with `hmtl` - which, of course, isn't the mime type you are looking for. Unless you are using HyperMarkup Text Language... – PinnyM Apr 04 '13 at 16:34