Sha256: fab8f5bcbd4c0917fded39f210084b7cd0b8e1e361b1f2eb897e739e8c253001

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 Bytes

Contents

require 'rubygems'
require 'dm-core'
$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

1 entries across 1 versions & 1 rubygems

Version Path
datamapper4rails-0.3.0 spec/spec_helper.rb