-
-
Save tonibergholm/45083 to your computer and use it in GitHub Desktop.
Revisions
-
dhh revised this gist
Jan 9, 2009 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # 2) Setup an Apache vhost to catch the star pointer: # # <VirtualHost *:80> # ServerName example.com # ServerAlias *.example.com # </VirtualHost> # -
dhh revised this gist
Jan 9, 2009 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,8 @@ # 2) Setup an Apache vhost to catch the star pointer: # # <VirtualHost *:80> # ServerName www.example.com # ServerAlias *.example.com # </VirtualHost> # # 3) Set the current account from the subdomain @@ -12,7 +13,7 @@ class ApplicationController < ActionController::Base private def set_current_account @current_account = Account.find_by_subdomain!(request.subdomains.first) end end -
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ # 1) Point *.example.com in your DNS setup to your server. # # 2) Setup an Apache vhost to catch the star pointer: # # <VirtualHost *:80> # ServerName *.example.com # </VirtualHost> # # 3) Set the current account from the subdomain class ApplicationController < ActionController::Base before_filter :set_current_account private def set_current_account @current_account = Account.find_by_subdomain(request.subdomains.first) end end # 4) Tie all top-level requests off the current account class CustomersController < ApplicationController def index @customers = @current_account.customers end end