On Fri, Mar 6, 2009 at 10:35 AM, Fresh Mix
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> What is the easiest way to replace record in database?
>
> Better that this:
>
> @old = Order.find(5)
> @new = Order.find(90)
>
> @old.x = @new.x
> @old.y = @new.y
@old.attributes = @new.attributes
or you can even get rid of @new completely
@old.attributes = Order.find(90).attributes
@old.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
-~----------~----~----~----~------~----~------~--~---