Skip to content

Instantly share code, notes, and snippets.

@andreferraro
Created July 12, 2010 02:16
Show Gist options
  • Save andreferraro/472046 to your computer and use it in GitHub Desktop.
Save andreferraro/472046 to your computer and use it in GitHub Desktop.
# exportação de TODOS os dados no formato xml e json
def export
@ufs = Uf.find(:all, :order => "uf")
prawnto :prawn => {:page_layout => :landscape}
respond_to do |format|
format.xml { render :xml => @ufs }
format.json { render :json => @ufs }
format.csv do
@output_encoding = 'ISO-8859-1'
@filename = "ufs.csv"
end
format.pdf { render :layout => false, :page_layout => :landscape, :pdf => @ufs, :pdf => @ufs }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment