Commit 9d0c3fb
committed
Don't mount routes to top-level context
Don't mount route helpers at top-level.
For instance, while serving an Ember application from `/admin/editor`,
the application could be mounted like this:
```rb
mount_ember_app :admin, to: "/admin/editor"
```
The previous implementation allows for this, as it was written with this
use case in mind.
Alternatively, the application could be mounted from within a
`namespace`, `scope`, or `constraint` block. Unfortunately, the previous
implementation doesn't support these use cases, since the routes are
mounted at the global level (i.e. in the first line of a
`Rails.application.routes.draw` block).
This commit adds support for the latter case, taking into account the
surrounding context with which the route helpers are invoked.1 parent 0482a46 commit 9d0c3fb
2 files changed
+9
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
21 | 20 | | |
22 | | - | |
| 21 | + | |
23 | 22 | | |
24 | | - | |
25 | | - | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
| |||
0 commit comments