Try your_active_record_instance.dup instead of .clone.
On Jan 6, 6:43 am, Rob Lacey
<r...-JfOZzmRpUsu/uRbK1X5IkLHvCTsVnGdA@public.gmane.org>
wrote:> Hi there,
>
> I''ve been working on a solution to try and fix a problem I am
getting
> with the Interlock plugin. However, my quick solution was to clone my
> ActiveRecord object and store the clone. I now realise that cloning
> ActiveRecord objects merely extracts the attributes and creates a new
> object with the same attributes. What I want is to clone the whole
> object, in this case assocations aren''t necessary just the object
with
> the correct id.
>
> Is there any reason why this would be bad? I guess cloning the object is
> generally used to duplicate records but here I want to take the object
> and cache it without affecting the original object.
>
> RobL
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---