xml-builder

Generate multiple XML files based on database

Hello, Can someone provide an example of using Builder to create multiple XML files from a SQL database. I can easily create one containing the entire database as in here... def index respond_to do |format| format.xml { @rides = Rides.find(:all) } end end This will create a file called index.xml based on a file I created calle...

Rails XML Builder: How do I in-explicitly construct XML elements?

I am trying to use xml builder without explicit definition of elements. This is useful when the required elements are variant. How can I accomplish something similar to the following? xml.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8" for col in [:customer, :name, :address, :city, :street, :postal_code] eval("xml.#{col.to_s....

Rails XML builder templates / group data

My SQL result @products=Product.find_by_sql() gives me this ( ID title, user_name 1 Product1 Xpeper 1 Product1 John 2 Product2 Xpeper How can I build XML in my xml.builder view file so the source bould be like this <products> <product> <id>1</id> <title>Product1</title> <users> <user>Xpe...

ruby on rails xml builder question

Anybody know how to produce an xml element like this in rails using xml Builder? <image:loc>http://example.com/image.jpg&lt;/image:loc&gt; xml.image :loc http://example.com/image.jpg Is supposed to work but doesn't. ...

Ruby on Rails: Using XML Builder Partials

Partials in XML builder are proving to be non-trivial. After some initial Google searching, I found the following to work, although it's not 100% xml.foo do xml.id(foo.id) xml.created_at(foo.created_at) xml.last_updated(foo.updated_at) foo.bars.each do |bar| xml << render(:partial => 'bar/_bar', :locals =>...

Can I add file size to Builder XML output

I'm working on a ruby on rails app that generates a large XML document using a builder template, but I've hit a bit of a stumbling point. The XML output must have a field that contains the file size in bytes. I think that I'll basically need to use the value that would populate the "Content-Length" header in the http response, but updat...

Rails Builder::XmlMarkup for Web Service - Repetitive Section

I am using Builder to construct XML messages being sent to a WebService. Each of the different methods require different xml but they all have a set of common elements to start of the request (mostly account authentication stuff). Is there any way to do it in a DRY way? Here is my code for constructing a change pass phrase request: #...