I\'m working through Michael Hartl\'s Rails tutorial, and I\'m running into an issue in section 7.3.3. I receive this error message:
ArgumentError in Users#
In your new.html.erb
you have specified form_for(@user)
that means you need to have some value in instance variable @user
before calling the new
action.
You can do it in two ways :
one way is define an action new
in your controller which would be called before rendering your new.html.erb
layout. For eg:
def new
@user = User.new
end
other way is that in your form itself you could specify something like
<%= form_for(User.new) do |f| %>
Defining it in your new
action is more standard way of doing it.