Sha256: e3ef64f3d55170cb49740405cf06d71bbc8f4677175fda743f626efae56de4b8

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 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

          attr_accessible :_id, :data

          if respond_to?(:identity)
            # pre-Mongoid 3
            identity :type => String
          else
            field :_id, :type => String
          end

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

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

  MongoidStore = ActionDispatch::Session::MongoidStore

rescue LoadError
end

Version data entries

1 entries across 1 versions & 1 rubygems

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