I have an XML view in a rails app, and need to insert in XML from another file for testing purposes.
I want to say "builder, just stuff this string in blindly, because it's already xml", but I can't see to see anything in the docs that does that.
I knew I'd figure it out right after posting a question. Using target! is the answer
xml.Foo do
xml.built('build with builder')
xml.alsobuilt do
xml.builtinside('built inside')
xml.target! << my_string_with_xml
end
end
Achieves the results desired.
xml.target! returns the object where the generated XML is being stored - in most cases, this is simply a string.The << my_string_with_xml then appends your string with XML directly to the output, before allowing Builder to continue.