@@ -42,7 +42,8 @@ The default assumes a `sessions` tables with columns:
42
42
43
43
* ` id ` (numeric primary key),
44
44
* ` session_id ` (string, usually varchar; maximum length is 255), and
45
- * ` data ` (text or longtext; careful if your session data exceeds 65KB).
45
+ * ` data ` (text, longtext, json or jsonb); careful if your session data exceeds
46
+ 65KB).
46
47
47
48
The ` session_id ` column should always be indexed for speedy lookups.
48
49
Session data is marshaled to the ` data ` column in Base64 format.
@@ -64,11 +65,14 @@ having a separate `id` column if you don't want it. However, you must
64
65
set ` session.model.id = session.session_id ` by hand! A before filter
65
66
on ApplicationController is a good place.
66
67
67
- The serializer may be one of ` marshal ` , ` json ` , or ` hybrid ` . ` marshal ` is
68
- the default and uses the built-in Marshal methods coupled with Base64
69
- encoding. ` json ` does what it says on the tin, using the ` parse() ` and
70
- ` generate() ` methods of the JSON module. ` hybrid ` will read either type
71
- but write as JSON.
68
+ The serializer may be class responding to ` #load(value) ` and ` #dump(value) ` , or
69
+ a symbol of ` marshal ` , ` json ` , ` hybrid ` or ` null ` . ` marshal ` is the default and
70
+ uses the built-in Marshal methods coupled with Base64 encoding. ` json ` does
71
+ what it says on the tin, using the ` parse() ` and ` generate() ` methods of the
72
+ JSON module. ` hybrid ` will read either type but write as JSON. ` null ` will
73
+ not perform serialization, leaving that up to the ActiveRecord database
74
+ adapter. This allows you to take advantage of the native JSON capabilities of
75
+ your database.
72
76
73
77
Since the default class is a simple Active Record, you get timestamps
74
78
for free if you add ` created_at ` and ` updated_at ` datetime columns to
0 commit comments