>
> Why is it that...
>
> {code}
>>> myarray = ["one"]
> => ["one"]
>>> myarray.to_xml
> RuntimeError: Not all elements respond to to_xml
> from /foo/vendor/rails/activerecord/lib/../../activesupport/lib/
> active_support/core_ext/array/conversions.rb:62:in `to_xml'
> from (irb):94
>>>
> {code}
>
> ... however ...
>
> {code}
>>> myarray2 = [{:one => "onevalue"}]
> => [{:one=>"onevalue"}]
>>> myarray2.to_xml
> => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<records type=\"array
> \">\n <record>\n <one>onevalue</one>\n </record>\n</records>\n"
>>>
In a nutshell, strings don't have a to_xml method, but hashes do.
> {code}
>
> Is there a way I can convert an array to xml without having to wrap
> each element in a hash???
>
What do you want the output to look like ?
Fred
> >