Forum: Ruby on Rails serialize with Marshal, YAML, or what?

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.
0f50b9a2ad85666d537d39bda49327ee?d=identicon&s=25 Jonathan Rochkind (jrochkind)
on 2008-12-03 18:47
If I want to serialize/unserialize arbitrary objects (not just ARs) in a
Rails app, what's the best way to do it?

Using 'Marshal' seems to be ruby standard. But then there's YAML. And
then I feel like maybe Rails adds yet another way to do it, but I can't
remember what it is and might be imagining that.

I don't understand the plusses/minuses of each option. I just want to be
able to serialize/unserialize arbitrary objects, what's my best bet?

Jonathan
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-12-03 19:03
(Received via mailing list)
On Dec 3, 5:47 pm, Jonathan Rochkind <rails-mailing-l...@andreas-
s.net> wrote:
> If I want to serialize/unserialize arbitrary objects (not just ARs) in a
> Rails app, what's the best way to do it?
>
> Using 'Marshal' seems to be ruby standard. But then there's YAML. And
> then I feel like maybe Rails adds yet another way to do it, but I can't
> remember what it is and might be imagining that.
>

Well an important thing is who are you talking to: Marshal is quite
easy to read from a ruby program but anything else and you're probably
out of luck. YAML on the other hand is more portable.

Fred
This topic is locked and can not be replied to.