Skip to content

Instantly share code, notes, and snippets.

Forked from dhh/gist:45076
Created July 11, 2009 05:05
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
# 1) Point * in your DNS setup to your server.
# 2) Setup an Apache vhost to catch the star pointer:
# <VirtualHost *:80>
# ServerName
# ServerAlias *
# </VirtualHost>
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
before_filter :set_current_account
def set_current_account
@current_account = Account.find_by_subdomain!(request.subdomains.first)
# 4) Tie all top-level requests off the current account
class CustomersController < ApplicationController
def index
@customers = @current_account.customers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment