Topic: Scaffolding newbie question

Hi everyone,

sorry, if this is a really stupid question, but there

Re: Scaffolding newbie question

According to the rails API, The new method let your @user inherit attributes from the User model (in other words, from your users table). This is to make sens to for e.g. or @user.login

And in the create method: @user =[:user]) is creating the object @user by recopying which is an OOP concept (creating a user and filling its attributes from params[:user]).

(i'm not sure about all what i said !)

Re: Scaffolding newbie question

Its rails magic smile creates a new User object, but does not save it. It is used because of page refresh. If you do not use then if you would enter something wrong and submit it, you would get an error for validation and your previous entry like name, e-mail etc. would not be there.[:user]) saves the user object.

Last edited by Eric_Jardas (2007-04-15 12:58:21)

Re: Scaffolding newbie question[:user]) saves the user object.

Except you mean User.create(params[:user]) saves the user object. - Brewery and Brewpub management powered by RoR

Re: Scaffolding newbie question

Oh mistake...actually what i wanted to write was:
@user =[:user])