mirror of
https://github.com/sinatra/sinatra
synced 2023-03-27 23:18:01 -04:00
document redirect back
This commit is contained in:
parent
da9bfdeabc
commit
fac44f71cd
1 changed files with 12 additions and 0 deletions
12
README.rdoc
12
README.rdoc
|
@ -802,6 +802,18 @@ Any additional parameters are handled like arguments passed to `halt`:
|
|||
redirect to('/bar'), 303
|
||||
redirect 'http://google.com', 'wrong place, buddy'
|
||||
|
||||
You can also easily redirect back to the page the user came from with
|
||||
`redirect back`:
|
||||
|
||||
get '/foo' do
|
||||
"<a href='/bar'>do something</a>"
|
||||
end
|
||||
|
||||
get '/bar' do
|
||||
do_something
|
||||
redirect back
|
||||
end
|
||||
|
||||
To pass arguments with a redirect, either add them to the query:
|
||||
|
||||
redirect to('/bar?sum=42')
|
||||
|
|
Loading…
Add table
Reference in a new issue