Sha256: 1286ce811d1ff6a166b1edf4be7ecfdde27e3bdbfb88c7423d0b21a8f55f4986

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

require 'rubygems'
require 'dm-core'
require 'base64'
$LOAD_PATH << Pathname(__FILE__).dirname.parent.expand_path + 'lib'

# just define a empty abstract store
module ActionController
  module Session
    class AbstractStore 
      def initialize(app, options = {})
      end
    end
  end
end

class Session
  
  include ::DataMapper::Resource

  property :session_id, String, :key => true
 
  property :updated_at, DateTime

  property :data, Text, :nullable => false, :default => ::Base64.encode64(Marshal.dump({}))
  
  def data=(data)
    attribute_set(:data, ::Base64.encode64(Marshal.dump(data)))
  end
  
  def data
    Marshal.load(::Base64.decode64(attribute_get(:data)))
  end 
end

DataMapper.setup(:default, {:adapter  => 'in_memory'})

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datamapper4rails-0.4.0 spec/spec_helper.rb
datamapper4rails-0.3.2 spec/spec_helper.rb
datamapper4rails-0.3.1 spec/spec_helper.rb