Forum: Ruby on Rails Updating a row in the database

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
thomazleite (Guest)
on 2007-06-08 02:16
(Received via mailing list)
What's the difference between updating an entry in the database using
the #save method and the #update method?

Thanks,
Thomaz
Cyril M. (Guest)
on 2007-06-08 02:38
(Received via mailing list)
On 6/8/07, thomazleite <removed_email_address@domain.invalid> 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.
Thomaz L. (Guest)
on 2007-06-08 05:36
(Received via mailing list)
On 7 jun, 18:37, "Cyril M." <removed_email_address@domain.invalid> wrote:
> On 6/8/07, thomazleite <removed_email_address@domain.invalid> 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.
Cyril M. (Guest)
on 2007-06-08 11:40
(Received via mailing list)
On 6/8/07, Thomaz L. <removed_email_address@domain.invalid> 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 topic is locked and can not be replied to.