The following code will render the subject:
format.xml { render :xml =>
@someClass.to_xml(:except=>SomeClass.column_names)}
BUT I’m having a hard time with adding attributes railsIsEasy=“true”
and to_xml_is_easy=“false”, which are values of methods in the class.
The :method option will only add another tag, it won’t add it as an
attribute in the xml tag. Before I code my own to_xml, I thought I’d
ask to see if there is something I’m missing. I don’t see anything in
the api that mentions an xml attribute, except for the type in the db.
On 9/14/07, Yottameter [email protected] wrote:
ask to see if there is something I’m missing. I don’t see anything in
the api that mentions an xml attribute, except for the type in the db.
You’ll just have to override it to produce custom XML. Look at the
actual implementation of #to_xml, I believe you can use
options[:builder] as an Xml::Builder instance and use that to build
your custom XML.
–
Rick O.
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
Ok, already done, thought I would check for a more elegant solution.
Thanks for the reply.