Skip to content

Instantly share code, notes, and snippets.

@georgel
Forked from durran/mongoid.rb
Created June 15, 2012 04:45
Show Gist options
  • Save georgel/2934707 to your computer and use it in GitHub Desktop.
Save georgel/2934707 to your computer and use it in GitHub Desktop.
Custom database persistence.
module CustomDatabase
extend ActiveSupport::Concern
included do
store_in database: custom_database
end
module ClassMethods
def custom_database
# Return a string for the database name based on the globals.
end
end
end
class User
include Mongoid::Document
include CustomDatabase
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment