aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorJonan Scheffler <jonanscheffler@gmail.com>2015-03-31 20:12:37 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2015-04-01 00:37:23 -0300
commit21a2d9a9871af731733bb2fcf31006139b2fc708 (patch)
treebaf4cf845f44af4b3fda67d900afd3789b20eb87 /guides/source
parente3e28e4dab69c6707e123b9185d07ae1aaed46ea (diff)
downloadrails-21a2d9a9871af731733bb2fcf31006139b2fc708.tar.gz
rails-21a2d9a9871af731733bb2fcf31006139b2fc708.tar.bz2
rails-21a2d9a9871af731733bb2fcf31006139b2fc708.zip
Update routing.md
This adds instructions for routing to rack applications with mount instead of match. I just spent an unreasonable amount of time staring at this, hopefully the next person will save some time. It's possible that the docs should simply advise people to use mount and leave out the match method but I don't know enough about the differences in the two approaches to assert that definitively.
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/routing.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 7d0a3efbe7..4ccc50a4d9 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -807,6 +807,18 @@ As long as `Sprockets` responds to `call` and returns a `[status, headers, body]
NOTE: For the curious, `'articles#index'` actually expands out to `ArticlesController.action(:index)`, which returns a valid Rack application.
+If you specify a rack application as the endpoint for a matcher remember that the route will be unchanged in the receiving application. With the following route your rack application should expect the route to be '/admin':
+
+```ruby
+match '/admin', to: AdminApp, via: :all
+```
+
+If you would prefer to have your rack application receive requests at the root path instead use mount:
+
+```ruby
+mount AdminApp, at: '/admin'
+```
+
### Using `root`
You can specify what Rails should route `'/'` to with the `root` method: