What's the best way to handle having two templates (or should it be one, DRY?) for xml builder templates?
I'm building a web api with Rails and wanted to see an example of how to have a view that does regular output vs one that does error output. I've been using @obj.to_xml for a while, but my requirements have changed and require me building my own error templates.
do you typically have both views in one with a condition above for errors such as
app/views/myresource/create.xml.builder
unless @myobj.errors.empty? // xml for errors here? end
Can someone show me an xml.builder view example that has a case handled for when there is an error with an ActiveRecord object and or when it's successful?
// regular xml view