XML Builder Partials in Rails
The past few days I've been creating an API with Rails and found that writing xml Builder files is slightly different then writing the usual erb in views. The biggest problem was keeping things DRY and using partials, it just doesn't work the same way. The following attempt to render does nothing in the xml.builder file:
render :partial => 'somepartial'
The reason is because the partial will receive a new xml Builder object rather than using the one already setup. You can do a few tricks such as passing in the xml builder object in as a local variable, but I found out that the cleanest way to do it is:
xml << render :partial => 'somepartial'
Hope that helps people looking to make partials with the XML Builder in Rails

