Im creating an api for my website and Im trying to roll my own. I know I can use activeresource and some other packages, but really what I would like is to be able to send simple xml data back and forth.
Im sticking with AR controllers since I use the respond_to block to output results in amf (via RubyAMF) and xml. So for the respond_to xml code, I want to be able to do
{}.to_xml and get something that can be translated back equivalently. on the other end.
Right now, if I want to get and array from xml, I have to send xml like: "<ids>1</ids><ids>2</ids><ids>3</ids><ids>4</ids>" to get params[:ids] and if its only "<ids>1</ids>", then params[:ids] is not an array.
I know Rails 2.0 is trying to make a better AR#to_xml function, but that doesnt aim at my use case.
Also something like [{:foo => ["bar","bar","bar"]}].to_xml will throw an error as well.
Somebody has had to have written a mirroring to_xml / from_xml function by this point.
Can anyone point me in the right direction?