Sha256: 2cf94af15e4258e0895ce44be86690e35774d5e3128c589241a8b972d13d3288

Contents?: true

Size: 773 Bytes

Versions: 1

Compression:

Stored size: 773 Bytes

Contents

begin
  require 'mongoid'
  require 'mongo_session_store/mongo_store_base'

  module ActionDispatch
    module Session
      class MongoidStore < MongoStoreBase
        
        class Session
          include Mongoid::Document
          include Mongoid::Timestamps
          self.collection_name = MongoSessionStore.collection_name
        
          identity :type => String

          field :data, :type => BSON::Binary, :default => BSON::Binary.new(Marshal.dump({}))
        end

        private
          def pack(data)
            BSON::Binary.new(Marshal.dump(data))
          end

          def unpack(packed)
            return nil unless packed
            Marshal.load(StringIO.new(packed.to_s))
          end
      
      end
    end
  end

rescue LoadError
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongo_session_store-rails3-3.0.1 lib/mongo_session_store/mongoid_store.rb