1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

correct double quotes for interpolation in routing guide [ci_skip]

This commit is contained in:
Cesar Carruitero 2012-11-08 17:16:38 -05:00
parent 5fe385ba93
commit 3738ef292a

View file

@ -668,8 +668,8 @@ get '/stories/:name', to: redirect('/posts/%{name}')
You can also provide a block to redirect, which receives the params and the request object:
```ruby
get '/stories/:name', to: redirect {|params, req| '/posts/#{params[:name].pluralize}' }
get '/stories', to: redirect {|p, req| '/posts/#{req.subdomain}' }
get '/stories/:name', to: redirect {|params, req| "/posts/#{params[:name].pluralize}" }
get '/stories', to: redirect {|p, req| "/posts/#{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.