Skip to content

Instantly share code, notes, and snippets.

@mkroman
Forked from fender21/gist:1420876
Created December 2, 2011 00:23
Show Gist options
  • Save mkroman/1420936 to your computer and use it in GitHub Desktop.
Save mkroman/1420936 to your computer and use it in GitHub Desktop.
Better way to route?
post :index do
if params.key?("create")
path = Padrino.root("tmp")
File.open(File.join(path, "#{params[:docId]}.pdf"), "w") do |file|
file.write request.body.read.force_encoding("UTF-8")
status 200
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment