Sha256: c583dfaa7d146a905dedca2fbdb2a09cc30a7e4841f4cfa3e6552593a629794f

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

require 'rubygems'
require 'dm-core'
require 'base64'
require 'pathname'
$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 :raw_data, Text, :required => true, :default => ::Base64.encode64(Marshal.dump({}))
  
  def data=(data)
    attribute_set(:raw_data, ::Base64.encode64(Marshal.dump(data)))
  end
  
  def data
    Marshal.load(::Base64.decode64(attribute_get(:raw_data)))
  end 
end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper4rails-0.5.2 spec/spec_helper.rb