aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorthe-undefined <joe.james@alliants.com>2015-11-13 07:10:32 +0000
committerJoe James <joe@joejames.io>2015-11-13 14:32:23 +0000
commit3fccecb87b04cd550713ebf5d735c2a6dbccb4a1 (patch)
tree7324819cb10eac1c4857a4efc173039ba95db4c2 /guides
parentb6537e430e9581fefe6992dc44732ee6b7947523 (diff)
downloadrails-3fccecb87b04cd550713ebf5d735c2a6dbccb4a1.tar.gz
rails-3fccecb87b04cd550713ebf5d735c2a6dbccb4a1.tar.bz2
rails-3fccecb87b04cd550713ebf5d735c2a6dbccb4a1.zip
[ci skip] add `controller:` argument to routing.md
Passing a `Symbol` to the `to:` argument for a `get` route requires a `controller` argument to also be defined. The documentation is missing the `controller:` argument, which leaving out raises a routing exception: ```ruby get 'profile', to: :show ``` ``` $ rake routes ArgumentError: Missing :controller key on routes definition, please check your routes. ``` Adding the `controller:` argument maps the route correctly: ```ruby get 'profile', to: :show, controller: 'users' ``` ``` $ rake routes profile GET /profile(.:format) users#show ```
Diffstat (limited to 'guides')
-rw-r--r--guides/source/routing.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index e4799d93fa..b8dd089753 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -142,10 +142,10 @@ Sometimes, you have a resource that clients always look up without referencing a
get 'profile', to: 'users#show'
```
-Passing a `String` to `get` will expect a `controller#action` format, while passing a `Symbol` will map directly to an action:
+Passing a `String` to `get` will expect a `controller#action` format, while passing a `Symbol` will map directly to an action but you must also specify the `controller:` to use:
```ruby
-get 'profile', to: :show
+get 'profile', to: :show, controller: 'users'
```
This resourceful route: