Being Careful with Rails Session Data
Posted by Scott on Mar 21st, 2007
In the book Agile Web Development with Rails, it is recommended that you move your HTTP session data from temp files (the default) into your database for speed and scalability. One problem this can create if you’re stuffing lots of data into your sessions is that database fields are of a limited size. MySQL uses text as the default type for the data column.
I ran into some limitations regarding this earlier this week, and the surefire symptom of it is the error “marshal data too short” in your logs. Fortunately, a quick Google search resulted in a few clear answers. I even found a migration example to change the column type from text to mediumtext (you can also use longtext if you’re really paranoid).