Updating a row in the database

What’s the difference between updating an entry in the database using
the #save method and the #update method?

Thanks,
Thomaz

On 6/8/07, thomazleite [email protected] wrote:

What’s the difference between updating an entry in the database using
the #save method and the #update method?

A save made a check for see if the Object exist or not. If exist, the
Object is save else, it’s update.

With the #update, you must use a id who exist and define the attribute
to update. And it’s a public classe Method not instance method, so you
use it only with Name class, not with your Object.


Cyril M.

On 7 jun, 18:37, “Cyril M.” [email protected] wrote:

On 6/8/07, thomazleite [email protected] wrote:

A save made a check for see if the Object exist or not. If exist, the
Object is save else, it’s update.

With the #update, you must use a id who exist and define the attribute
to update. And it’s a public classe Method not instance method, so you
use it only with Name class, not with your Object.

I’m coding a change password method in my application. When I use
#update, a invalid password gets saved. The same doesn’t happens with
#save.

On 6/8/07, Thomaz L. [email protected] wrote:

I’m coding a change password method in my application. When I use
#update, a invalid password gets saved. The same doesn’t happens with
#save.

How use you update method ?


Cyril M.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs