Created
May 16, 2009 03:04
-
-
Save thisivan/112550 to your computer and use it in GitHub Desktop.
Multitenant Application (Subdomain)
This file contains 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 characters
class ApplicationController < ActionController::Base | |
before_filter :set_current_account | |
private | |
def set_current_account | |
@current_account = | |
Account.find_by_subdomain(request.subdomains.last) | |
end | |
end | |
class CustomersController < ApplicationController | |
def index | |
@customers = @current_account.customers | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment