What''s the difference between updating an entry in the database using the #save method and the #update method? Thanks, Thomaz --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/8/07, thomazleite <thomazleite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Mougel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 7 jun, 18:37, "Cyril Mougel" <cyril.mou...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 6/8/07, thomazleite <thomazle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 6/8/07, Thomaz Leite <thomazleite-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On 7 jun, 18:37, "Cyril Mougel" <cyril.mou...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On 6/8/07, thomazleite <thomazle...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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. >How use you update method ? -- Cyril Mougel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---