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

Merge pull request #32115 from avneetmalhotra/routing_bound_parameters_guide_fix

Correct `to` option's value of the route in the Bound Parameters sect…
This commit is contained in:
Rafael França 2018-02-26 22:02:47 -05:00 committed by GitHub
commit 19460585d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -549,7 +549,7 @@ In particular, simple routing makes it very easy to map legacy URLs to new Rails
When you set up a regular route, you supply a series of symbols that Rails maps to parts of an incoming HTTP request. For example, consider this route:
```ruby
get 'photos(/:id)', to: :display
get 'photos(/:id)', to: 'photos#display'
```
If an incoming request of `/photos/1` is processed by this route (because it hasn't matched any previous route in the file), then the result will be to invoke the `display` action of the `PhotosController`, and to make the final parameter `"1"` available as `params[:id]`. This route will also route the incoming request of `/photos` to `PhotosController#display`, since `:id` is an optional parameter, denoted by parentheses.