Skip to content

Instantly share code, notes, and snippets.

@minhajuddin
Forked from durran/mongoid.rb
Created December 5, 2012 19:34
Show Gist options
  • Select an option

  • Save minhajuddin/4218786 to your computer and use it in GitHub Desktop.

Select an option

Save minhajuddin/4218786 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