Created
May 20, 2011 01:27
-
-
Save mankind/982172 to your computer and use it in GitHub Desktop.
creating a new collection per new account
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 characters
#creating a new collection called based on name supplied | |
def self.create_tenant(name) | |
@connection = Mongo::Connection.new | |
@db = @connection.db("#{name}") | |
@coll = @db.collection("#{name}") | |
end | |
#creating a new account should automatically create collection | |
def self.create_account(name) | |
create_tenant(name) | |
account = Account.create([ | |
account.new( :name=> "#{name}", :subdomain => ' ') | |
]) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment