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