summaryrefslogtreecommitdiff
path: root/lib/warden/session_serializer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/warden/session_serializer.rb')
-rw-r--r--lib/warden/session_serializer.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/warden/session_serializer.rb b/lib/warden/session_serializer.rb
new file mode 100644
index 0000000..81d7076
--- /dev/null
+++ b/lib/warden/session_serializer.rb
@@ -0,0 +1,13 @@
+module Warden
+ # Setup Session Serialization
+ class SessionSerializer
+ def serialize(record)
+ [record.class.name, record.id]
+ end
+
+ def deserialize(keys)
+ klass, id = keys
+ klass.constantize.find(id)
+ end
+ end
+end