one of our controller methods is invoked by a remote system, and it returns only xml.
in our foo controller we have
def return_some_data
@thename = "JOHN DOE"
respond_to do |format|
format.xml
end
end
in our views/foo/return_some_data.xml we have
<Response>
<Name>#{@thename}</Name> << that doesnt work
</Response>
I thought, like haml views, that #{@thename} would be substituted, but it’s not.
How do I ‘insert’ variable data into this XML view?
You need to provide the file with an extension that makes it being processed by one of the engines. I imagine you could just rename the return_some_data.xml to return_some_data.xml.erb to have it processed by the standard engine. You will then have to use a slightly different syntax for you embedded code: