Yottameter
2007-Sep-15 01:44 UTC
<someClass railsIsEasy="true" to_xml_is_easy="false"> </someClass>
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Rick Olson
2007-Sep-15 19:57 UTC
Re: <someClass railsIsEasy="true" to_xml_is_easy="false"> </someClass>
On 9/14/07, Yottameter <yottameter-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > 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.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 Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yottameter
2007-Sep-15 22:37 UTC
Re: <someClass railsIsEasy="true" to_xml_is_easy="false"> </someClass>
Ok, already done, thought I would check for a more elegant solution. Thanks for the reply. On Sep 15, 12:57 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9/14/07, Yottameter <yottame...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > 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 Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---