mysql - Exporting data from Rails into XML and Excel -
i use rubyonrails , want data within database xml or excel format.
how can it?
exporting xml simple, can call to_xml method on items , render result or use render :xml
http://guides.rubyonrails.org/layouts_and_rendering.html#using-render
so example, in controller:
respond_to |format| format.html format.xml { render xml: @items } end when comes excel, there railscast on exporting csv (which can imported excel) , xls.
Comments
Post a Comment