To_xml/to_json and serialized columns

The AR serializer is great, but it if you’re dealing with serailized
columns it jams yaml into the result, or whatever you’re serializing
columns to.

If you are serializing the AR object to_xml/to_json, chances are you
want the whole object in that format,not part of it.

Is there a way to tell the AR serializer it should to pay attention to
serialized columns, rather than simply treating them as text columns?

Sorry…I was incorrect about one thing. The Serializer is detecting
which columns are are flagged as serialized, however it will only
serialize them as YAML.

So say you have a Customer object, and serialized column called
favorite_products, which contains an array of product id’s…

You call Customer.find(1).to_xml, or Customer.find(1).to_json, you
respectively get an xml or json representation of that object, however
favorite_products will be yaml embedded in into the xml/json…when
more often than not you’d want that to be xml or json as well.


I found this old email from you.

How did you fix it?
I have YAML serialized data and need to send it over XML.


On Aug 10 2008, 1:43 am, Brandon C. <rails-mailing-l…@andreas-