A working from_xml including child relationships


#1

Hi all,

I’ve been looking at some options for getting a from_xml
implementation working with ActiveRecord based classes. I had a few
issues and couldn’t resolve them, so I rolled my own. Seems to work
well for simple parent > child relationships, including collections.

I thought I’d post in case anyone else was similarly afflicted. Here’s
the blog post to get the code. Please add comments to let me know what
you think. (Or to tell me I’m an idiot and missed something!)

http://web.me.com/adamfowleruk/adamsapple/Blog/Entries/2009/2/6_Ruby_incoming_XML_processing.html

Regards,

Adam.


#2

Oh BTW just added recursive to_xml too, which supports
ActiveRecord::Base objects

http://web.me.com/adamfowleruk/adamsapple/Blog/Entries/2009/2/6_Ruby_to_xml_implementation.html

Adam.