How about: puts User.find_by_id(params[:id]).to_xml
On Aug 4, 5:42 pm, Shandy Nantz <[email protected]> wrote: > I am trying to read some information based on a user id, then search the > database for the needed info and build an XML file. Everything seems to > be working fine; I read the info, I create the xml and even spit "stuff" > out to file. The issue is that the "stuff" I am writing to a file is a > xml/html cross cluster #...@%$ of stuff. Here is some code: > > if !params[:id].blank? > @user = User.find_by_id(params[:id]) > > @xml = ::Builder::XmlMarkup.new > @unusedtickets = Unusedticket.find(:all, :conditions => ['user_id = > ? and > updated = true', @user.id]) > end > > @xml.DocumentElemnts{ > for unusedticket in @unusedtickets > @xml.unusedtickets do > @xml.account_id(unusedticket.account_id) > @xml.locator(unusedticket.locator) > @xml.ticketnumber(unusedticket.ticketnumber) > @xml.traveler(unusedticket.traveler) > @xml.issuedate(unusedticket.issuedate) > end > end > } > > headers["Content-Type"] ||= 'text/xml' > headers['Cache-Control'] = 'private' > headers["Content-Disposition"] ||= "attachment; filename=\"test_xml\"" > render :text => @xml, :layout => nil > > I really thought that if I said :layout => nil that would strip away all > the html formatting, but apperantly not. Is there a way that I can write > this information to a file and have it be strictly XML? Thanks, > > -S > -- > Posted viahttp://www.ruby-forum.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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

