aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2015-08-08 12:27:55 +0900
committeryui-knk <spiketeika@gmail.com>2015-08-08 12:27:55 +0900
commit235155302ee9ce5bb5305d570abe69db35a336a0 (patch)
tree282cb8a084f5b47b6eb0b184b9cc8dd69cc6c4e8 /guides
parent05934d24aff62d66fc62621aa38dae6456e276be (diff)
downloadrails-235155302ee9ce5bb5305d570abe69db35a336a0.tar.gz
rails-235155302ee9ce5bb5305d570abe69db35a336a0.tar.bz2
rails-235155302ee9ce5bb5305d570abe69db35a336a0.zip
[ci skip] Add an explanation for `status` option
Diffstat (limited to 'guides')
-rw-r--r--guides/source/routing.md6
1 files changed, 5 insertions, 1 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index cf828462ce..079fd87a64 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -795,7 +795,11 @@ get '/stories/:name', to: redirect { |path_params, req| "/articles/#{path_params
get '/stories', to: redirect { |path_params, req| "/articles/#{req.subdomain}" }
```
-Please note that this redirection is a 301 "Moved Permanently" redirect. Keep in mind that some web browsers or proxy servers will cache this type of redirect, making the old page inaccessible.
+Please note that default redirection is a 301 "Moved Permanently" redirect. Keep in mind that some web browsers or proxy servers will cache this type of redirect, making the old page inaccessible. You can use the `:status` option to change the response status:
+
+```ruby
+get '/stories/:name', to: redirect('/articles/%{name}', status: 302)
+```
In all of these cases, if you don't provide the leading host (`http://www.example.com`), Rails will take those details from the current request.