Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2012 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1917678 to your computer and use it in GitHub Desktop.
Save anonymous/1917678 to your computer and use it in GitHub Desktop.
JRuby Monkey patch gist 1
module MongoSessionStore
def self.collection_name=(name)
@collection_name = name
if defined?(MongoStore::Session)
MongoStore::Session.reset_collection
end
if defined?(MongoMapperStore::Session)
MongoMapperStore::Session.set_collection_name(name)
end
if defined?(MongoidStore::Session)
MongoidStore::Session.store_in(name)
end
end
# default collection name for all the stores
self.collection_name = "sessions"
end
autoload :MongoMapperStore, 'mongo_session_store/mongo_mapper_store'
autoload :MongoidStore, 'mongo_session_store/mongoid_store'
autoload :MongoStore, 'mongo_session_store/mongo_store'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment