Downloading XML file instead of rendering using Builder
I am currently using Builder to make a custom XML export. However when the
user clicks the button I want the .xml to download instead of rendering.
I have tried using send_data instead of render but that seems to be
overridden by builder.
Also using ActiveAdmin (hence the member_action)
In my controller:
member_action :show do
@listing = Listing.find(params[:id])
respond_to do |format|
format.html
format.xml
end
end
Links to show.xml.builder
xml.instruct!
xml.XMLopener { |b|
b.....
......
....
}
I have looked at a few links below but I can't seem to get it working. Any
ideas? Obviously with the current code it is just rendering, which works
perfectly.
https://www6.software.ibm.com/developerworks/education/x-rubyonrailsxml/x-rubyonrailsxml-a4.pdf
http://danengle.us/2009/05/generating-custom-xml-for-your-rails-app/
No comments:
Post a Comment