diff options
author | Rafael Sales <rafaelcds@gmail.com> | 2015-10-10 08:14:58 -0300 |
---|---|---|
committer | Rafael Sales <rafaelcds@gmail.com> | 2015-10-10 08:22:31 -0300 |
commit | 4db921a8e7dff22eec026e809c39567db6a9ee32 (patch) | |
tree | 106853ed591a650742fa26259e3924878abf5b88 /activerecord/test/models/notification.rb | |
parent | 0450642c27af3af35b449208b21695fd55c30f90 (diff) | |
download | rails-4db921a8e7dff22eec026e809c39567db6a9ee32.tar.gz rails-4db921a8e7dff22eec026e809c39567db6a9ee32.tar.bz2 rails-4db921a8e7dff22eec026e809c39567db6a9ee32.zip |
Allow multiple `root` routes in same scope level
When an application has multiple root entries with different
constraints, the current solution is to use `get '/'`. Example:
**Currently I have to do:**
```ruby
get '/', to: 'portfolio#show', constraints: ->(req) { Hostname.portfolio_site?(req.host) }
get '/', to: 'blog#show', constraints: ->(req) { Hostname.blog_site?(req.host) }
root 'landing#show'
```
**But I would like to do:**
```ruby
root 'portfolio#show', constraints: ->(req) { Hostname.portfolio_site?(req.host) }
root 'blog#show', constraints: ->(req) { Hostname.blog_site?(req.host) }
root 'landing#show'
```
Other URL matchers such as `get`, `post`, etc, already allows this, so I
think it's fair that `root` also allow it since it's just a shortcut for
a `get` internally.
Diffstat (limited to 'activerecord/test/models/notification.rb')
0 files changed, 0 insertions, 0 deletions