[LRUG] Best way to serialise a Ruby object?
Andrew McDonough
andrew at andrewmcdonough.co.uk
Thu Jul 14 02:27:54 PDT 2011
Hi Andy
At the moment it's still just YAML, but there is support for custom
serialize methods (and for writing your own) in Rails 3.1, as
described by Aaron Patterson in his RailsConf 2011 talk, "Double
Dream Hands: So Intense!" from around 16:00:
http://bit.ly/pABZwG
If you're wondering why the presentation has a strange name, watch the
last 10 minutes (from 40:00). I do warn you though, it can't be
unwatched.
If you want to use something other than YAML in older Rails, you can
just serialize and deserialize yourself.
Andrew McDonough
---
CTO, Tribesports
http://tribesports.com
http://twitter.com/andrewmcdonough
On 14 July 2011 10:11, Andrew Stewart <boss at airbladesoftware.com> wrote:
> Hola El Rug,
>
> 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?
>
> To date I've been using YAML but I've run across a situation where the YAML written by Ruby can't be de-serialised again (due, I think, to Sych versus Psych).
>
> Should I be switching to something other than YAML?
>
> Cheers,
> Andy Stewart
>
> -------
> http://airbladesoftware.com
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>
More information about the Chat
mailing list