avoiding redirect
Depending on the subdomain I want to call a specific controller.
What I currently do:
My page uses the subdomain to identify users like username.site.com
. I get the username, look it up in the database and render the appropriate data in the UsernamesController
.
the only exception to this is www.site.com or site.com . In that case another controller should be called. I currently do this by detecting the www
o开发者_如何学Pythonr ''
subdomain in `ApplicationController and then redirecting. Although I feel that a redirect is not in it's place here.
Someone has another approach?
Thanks
subdomains_routes allows you to define custom routes based on current subdomain.
精彩评论