I am so sorry I made this confusing: Obj is not a constant. Not sure why
I had it capitalized.
This is really all I am doing in a console. Unfortunately, it will be
really difficult for me to share the object itself. It is a hash of
fairly nested ActiveRecord objects. I am not sure how to extract it from
the rest of my project.
Is there a way to "debug" Marshal? Could there be something that
explains the fact that it does not work properly the first time, and
correctly the second time? Could it be a memory allocation or something?
Thanks guys.
Unfortunately extracting ps from its context would be really
complicated. It is a hash of nested AR objects. I tried to reproduce
with simpler objects but it did not work.
I will have to try and find my way in the Marshal.dump code.
Is there a way to "debug" Marshal? Could there be something that
explains the fact that it does not work properly the first time, and
correctly the second time? Could it be a memory allocation or something?
If you compile your own ruby (not a difficult task, but then again,
probably not your piece of cake if you dabble with complex
ActiveRecord stuff...) Marshal is neatly included in file marshal.c,
at the root of the distribution. 1971 lines of code. You can always
run the Ruby interpreter under gdb, and/or add any sort of printout to
follow what is happening.
--
* Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
* di parlare tanto di amore e di rettitudine? (Chuang-Tzu)
If AR means ActiveRecord then you may run into the situation that
those objects store state related to the current connection or
transaction which cannot be properly serialized and deserialized. It
may be necessary to copy the object tree or unlink them from the
database (no AR expert here, but others may explain better).
Kind regards
robert
···
On Tue, Oct 30, 2012 at 1:22 AM, Pierre J. <lists@ruby-forum.com> wrote:
Thanks guys.
Unfortunately extracting ps from its context would be really
complicated. It is a hash of nested AR objects. I tried to reproduce
with simpler objects but it did not work.
I will have to try and find my way in the Marshal.dump code.
Can you check if the value returned by Marshal.dump(Obj) on subsequent
calls is indeed the same? (It's a binary string, just assign to some
variable and compare with ==.)