I want to show my users the xml that gets generated for a certain action.
Consider that I have a PostController and the following views:
/views/posts/show.xml.builder/views/posts/preview_xml.html.erb
In my preview_xml action I want to be able to parse the show.xml.builder just like if it was called directly and output the result in the html.
I know with ERB it is possible with:
ERB.new(File.read(path_to_file)).result(bindings)
But I have not found a working equivalent for Builder
Has anyone else run into this? Ideas to solve or work around?
Thanks!
Figured it out by reading Rails Template engine:
my preview_xml method looks like the following: