Skip to content

Instantly share code, notes, and snippets.

@durran
Created June 9, 2012 07:27
Show Gist options
  • Save durran/2899978 to your computer and use it in GitHub Desktop.
Save durran/2899978 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