Forum: Ruby on Rails update_attrbutes without saving?

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.
43335f8216edbe5342af1075ceec4d0a?d=identicon&s=25 =?iso-8859-1?Q?Rub=E9n_Gil?= (Guest)
on 2005-12-19 14:35
(Received via mailing list)
Hello all,

Is there a method for updating all the attributes from a hash without
saving to the database? (the counterpart of update_attributes but
without saving).

What I want to do is:

person = Person.find(params[:id])
person.update_without_saving(params[:person]) #update the in-memory
object.
# Process person object
.......
person.save

I know that when you are creating a new object, you can use Person.new
(updates in memory object) or Person.create (updates and saves to the
database), but don't know if the second option (apart from
update_attributes that saves to the database) exist when updating.

Thanks in advance,

Ruben



extreme development, S.L.
Paseig del Ferrocarril 335, Planta 3
08860 Castelldefels

Tel.  93 145 87 20
Fax. 93 145 87 21
5c19f2d52879a1e10670c7334ba4c7e3?d=identicon&s=25 Lugovoi Nikolai (Guest)
on 2005-12-19 14:59
(Received via mailing list)
Rubén Gil wrote:
> Hello all,
>
> Is there a method for updating all the attributes from a hash without
> saving to the database? (the counterpart of update_attributes but
> without saving).
>

Person.attributes = params[:person]
43335f8216edbe5342af1075ceec4d0a?d=identicon&s=25 =?iso-8859-1?Q?Rub=E9n_Gil?= (Guest)
on 2005-12-19 16:08
(Received via mailing list)
Lugovoi,

Thanks for your rapid response.

Ruben




extreme development, S.L.
Paseig del Ferrocarril 335, Planta 3
08860 Castelldefels

Tel.  93 145 87 20
Fax. 93 145 87 21



-----Mensaje original-----
De: rails-bounces@lists.rubyonrails.org
[mailto:rails-bounces@lists.rubyonrails.org] En nombre de Lugovoi
Nikolai
Enviado el: lunes, 19 de diciembre de 2005 14:53
Para: rails@lists.rubyonrails.org
Asunto: [Rails] Re: update_attrbutes without saving?

Rubén Gil wrote:
> Hello all,
>
> Is there a method for updating all the attributes from a hash without
> saving to the database? (the counterpart of update_attributes but
> without saving).
>

Person.attributes = params[:person]

_______________________________________________
Rails mailing list
Rails@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails
This topic is locked and can not be replied to.