After
script/generate authenticated user sessions
users_controller.rb is created with
def new
@user = User.new
end
and the view has this line:
@user.password = @user.password_confirmation = nil
and that’s it. Is this actually needed? I mean the form will POST to /users which is by RESTful routing, going to UsersController#create, so the @user created actually is never used. Is it actually needed and why? thanks.
Update: @user is never used again any where else… also, I tried removing those two lines
@user = User.new
and
@user.password = @user.password_confirmation = nil
and I can still use the form to create a new user…
In the view it kind of makes sense. Let say user account creation fails – you’ll be re-rendering the
newview with a different (not new)@userobject. I’d probably reset the password and password_confirmation in the action.