[LRUG] Best way to serialise a Ruby object?

Abdel A Saleh abdel.a.saleh at gmail.com
Thu Jul 14 03:57:13 PDT 2011


MessagePack looks really exciting!

-- 
Abdel A Saleh
twitter: @abdels / @TheSuperOwl

On 14 July 2011 11:37, Tatsuya Ono <ononoma at gmail.com> wrote:

> MessagePack might interest you to look at.
> http://msgpack.org/
>
> Tatsuya
> twitter.com/ono
>
> On 14 July 2011 10:31, Olly Legg <ollylegg at gmail.com> wrote:
>
>> > What's the best way these days to serialise a Ruby object for storage in
>> a SQL database field, and de-serialise it back again?
>>
>>
>> Rails uses YAML, so its probably not a bad bet.
>>
>> > Marshal.dump would be the obvious choice.  Just make sure you're
>> > either storing it as binary or converting to base64 first, to avoid
>> > interesting encoding/decoding problems in mysql.
>>
>> Rails used to use Marsahl.dump by default but, as far as I understand it,
>> it's not guaranteed to be readable by future ruby versions. So when people
>> upgraded Ruby they could no longer de-serialize the data they had already
>> stored.
>>
>> This prompted switching the default to YAML. However this looks like it
>> wasn't as foolproof as they intended.
>> _______________________________________________
>> Chat mailing list
>> Chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>>
>
>
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20110714/3896b07a/attachment.html>


More information about the Chat mailing list