@@ -31,7 +31,8 @@ The default assumes a `sessions` tables with columns:
3131
3232* ` id ` (numeric primary key),
3333* ` 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).
3536
3637The ` session_id ` column should always be indexed for speedy lookups.
3738Session 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
5354set ` session.model.id = session.session_id ` by hand! A before filter
5455on ApplicationController is a good place.
5556
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.
6165
6266Since the default class is a simple Active Record, you get timestamps
6367for free if you add ` created_at ` and ` updated_at ` datetime columns to
0 commit comments