This is a quick one, and the title says most of it. Basically, you should never have code like this in your app:
1 2 3 4 5 6 7 8 9 10 11 |
|
The whole point of the router is to handle stuff about the url! Instead, move whatever the logic inside
something_about_the_url?
does upstream to the router layer. For example, say you want to display a different
home page for www.mysite.com and blog.mysite.com. This can be accomplished very easily using the router:
1 2 3 4 5 |
|
Note that, in this specific case, you must have the subdomain route above the root
route, otherwise the router
will match the route to static#home
before it gets to the subdomain constraint. Remember that the router
checks routes in order. All set!