document attachment helper

This commit is contained in:
Konstantin Haase 2011-02-20 15:49:36 +01:00
parent b40d8ca224
commit 1996436204
1 changed files with 17 additions and 0 deletions

View File

@ -999,6 +999,23 @@ The <tt>request.body</tt> is an IO or StringIO object:
"Hello #{data['name']}!"
end
=== Attachments
You can use the +attachment+ helper to tell the browser the response should be
stored on disk rather than displayed in the browser.
get '/' do
attachment
"store it!"
end
You can also pass it a file name:
get '/' do
attachment "info.txt"
"store it!"
end
=== Looking Up Template Files
The <tt>find_template</tt> helper is used to find template files for rendering: