Sha256: f7bcff1cd149a2bb200a95c4f157df3af4b074e6a78b3555aa54aa28ec371469
Contents?: true
Size: 537 Bytes
Versions: 116
Compression:
Stored size: 537 Bytes
Contents
module CoalescingPanda class Session < ActiveRecord::Base serialize :data, Hash def self.create_from_session(session) params = {} session.keys.each do |key| params[key] = session[key] end token = SecureRandom.hex(10) Session.create(token: token, data: params) token end def self.restore_from_token(token, session) saved_session = Session.find_by_token(token) saved_session.data.each_pair do |key, value| session[key] = value end end end end
Version data entries
116 entries across 116 versions & 1 rubygems