module MongoSessionStore
  def self.collection_name
    @collection_name
  end

  def self.collection_name=(name)
    @collection_name = name

    if defined?(MongoStore::Session)
      MongoStore::Session.reset_collection
    elsif defined?(MongoidStore::Session)
      MongoidStore::Session.store_in \
        :collection => MongoSessionStore.collection_name
    end

    @collection_name
  end

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

if defined?(Mongoid)
  require "mongo_session_store/mongoid_store"
elsif defined?(Mongo)
  require "mongo_session_store/mongo_store"
end

module MongoSessionStore
  def self.collection_name
    @collection_name
  end

  def self.collection_name=(name)
    @collection_name = name

    if defined?(MongoidStore::Session)
      MongoidStore::Session.store_in \
        :collection => MongoSessionStore.collection_name
    end

    if defined?(MongoStore::Session)
      MongoStore::Session.reset_collection
    end

    @collection_name
  end
end

if defined?(Mongoid)
  require "mongo_session_store/mongoid_store"
elsif defined?(Mongo)
  require "mongo_session_store/mongo_store"
end

# Default collection name for all the stores.
MongoSessionStore.collection_name = "sessions"

Fix collection_name= with multiples stores loaded
Fix collection_name= with multiples stores loaded

Wouldn't set the collection name on all stores, just the first one
checked.
