Sha256: c8c3965a8cc130b9ce6df8cf60d49853c17ac35a9144ce13720d3f5288fe18ea

Contents?: true

Size: 760 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
datamapper4rails-0.5.1 spec/spec_helper.rb
datamapper4rails-0.5.0 spec/spec_helper.rb