In the Rails 3 timeframe, I would like Rails to...

Support for dynamic subdomains

I want an easy way to achieve the sort of dynamic subdomains you see on blogspot and even basecamp. I know there are ways to do it via plugins and such, but I'd like it to be significantly easier than it is now.

297 votes
Vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    I agree to the terms of service
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    micahwedemeyermicahwedemeyer shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    5 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      I agree to the terms of service
      Signed in as (Sign out)
      Submitting...
      • Vikrant ChaudharyVikrant Chaudhary commented  ·   ·  Flag as inappropriate

        While Basecamp/Blogspot style subdomains are easy. Rails 3 should support dynamic subdomains out-of-the-box, where some controllers belong _only_ to "www ", some to "help.", some to /^[a-z]{2,}\.wiki/ (like en.wiki.example.org) and some to /^[a-z0-9]+\.user/. it's more like dynamic subdomains in Wordpress/Livejournal than in Basecamp/Blogspot.

        And of course, not forgetting, link_to("Help", root_url(:subdomain => 'help')).

        - just some raw imaginations.

      • MarkMark commented  ·   ·  Flag as inappropriate

        I think this request is also about keeping the Rail's named_route helper methods in the views and controllers.

        It would be great if the view and controller code didn't need to change, and we were able to turn subdomains on and off easily in routes or environment configuration files. Someone may want to run development without subdomains and production with them.

      • carpeliamcarpeliam commented  ·   ·  Flag as inappropriate

        This isn't that hard in rails now as dhh has said, but i think merb gets this right, it belongs in the router.

      • wycatswycats commented  ·   ·  Flag as inappropriate

        This is currently available in the Merb router, which is being ported to Rails. Glad to see interest in this. (merb's router supports routing by any element of Request)

      Feedback and Knowledge Base