Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4013926
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:25:57+00:00 2026-05-20T09:25:57+00:00

After script/generate authenticated user sessions users_controller.rb is created with def new @user = User.new

  • 0

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…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T09:25:58+00:00Added an answer on May 20, 2026 at 9:25 am

    In the view it kind of makes sense. Let say user account creation fails – you’ll be re-rendering the new view with a different (not new) @user object. I’d probably reset the password and password_confirmation in the action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial (seems good) for Rails. After I run ruby script/generate scaffold
I have a script that needs to run after tomcat has finished starting up
I execute the following commands to make the model: script/generate model user firstname:string lastname:string
Let's say I used the following command to create a User model: script/generate model
I've created a model for an existing table using the following generator command: script/generate
After reading this question , I was reminded of when I was taught Java
immediately after has_many_polymorphs install with ruby script/plugin install git://github.com/fauna/has_many_polymorphs.git i start getting following error
I installed rails 3 beta in my OSX Leopard. After that, I've created a
I've tried using this pack to do database migration after I changed the EF
After reading the Head First Design Patterns book and using a number of other

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.