This is a general questions, but one that I have tested and think I know
the answer to but…
Lets say I have a table called Users and I create an object to store
data for a user in an object called @user. Now, I save that user info by
saying ‘@user.save’. Now, lets say later on I do a @user =
User.find_by_id( params[:id] ) which will have the same id for the
previous user. And then I say @user.save. If I’m understanding things
right, these actiosn will create only one user in the database since
they both have the same id’s, but the second save acts as an update? Is
this write.
The reason I ask is because I am making a form that allows a user to
create user information one step at a time. Then at the end all their
info is redisplayed and they ‘confirm’ that it is write and then any
changes that they made, or if they didn’t make any changes, are saved
back to the database. I just want to make sure that this will not create
multiple entries for the same user. It doesn’t to have done so, but hen
again I have not played with it that much. Thanks,
–Shandy