MultiSite ========= multi_site is a plugin by Sébastien Grosjean (aka ZenCocoon ) Many thanks to Sébastien Gruhier (aka Mr Proto ) for is precious help MultiSite functionality ======================= multi_site facilitates multi-site creation. It's made to convert a single application in a multi-site one with a minimum changes. MultiSite usage =============== To convert your application, you will need to make few changes : 1) Create a Site model and Sites table 2) Add site_id to your existing models (except Site of course) 3) Make relationship between Site and other models 4) Add the class variable "current_site" to the model Site 5) Initialize Site.current_site before every request (eg: app/controllers/application.rb) eg: # app/model/site.rb class Site < ActiveRecord::Base cattr_accessor :current_site has_many :users end # app/model/user.rb class User < ActiveRecord::Base belongs_to :site end # app/controllers/application.rb class ApplicationController < ActionController::Base # ... # Don't forget that @current_site should be properly setup to be a Site object # for this purpose you can use the plugin AccountLocation from David Heinemeier Hansson Site.current_site = @current_site end MultiSite effect ================ The plugin overwrite few methods from ActiveRecord::Base To have a better understanding of what it does, the best way is still to look at the code itself and the tests. Copyright (c) 2007 Sébastien Grosjean, released under the MIT license