RailsCasts Pro episodes are now free!

Learn more or hide this

mastmead's Profile

GitHub User: mastmead

Comments by

Avatar

ok, so it was a problem with my routes file. I've now copied the routes from cast #250 (thanks to Tim Fletcher) and everything works fine - without the respond_to code.

Avatar

I had a problem with the users_controller as posted in the screencast. I copied it directly into my app, and on running got - undefined method `model_name' for NilClass:Class. I'm not sure if this was an issue with my routes, but rails needed a respond_to to be able to handle the "new" request. ie

ruby
def new
    @user = User.new
    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @user }
    end
end

Probably only an issue if new to rails!
(Currently running rails 3.1.3)