Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 36 lines (26 sloc) 0.802 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
require 'securerandom'

$:.unshift File.dirname(__FILE__)

module MongoSessionStore
  autoload :VERSION, 'mongo_session_store/version'

  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

    @collection_name
  end

  def self.collection_name
    @collection_name
  end
  
  # default collection name for all the stores
  self.collection_name = "sessions"
end

require 'mongo_session_store/mongo_mapper_store'
require 'mongo_session_store/mongoid_store'
require 'mongo_session_store/mongo_store'
Something went wrong with that request. Please try again.