Attempting to put sessions into the database (Chapter 8 Task C), I run into a “Data too long for column” problem if I use MySQL, but the identical setup works fine for SQLLite3. I’m only changing the database.yml file, with everything identical as far as I can tell, dropping all tables manually and doing a migrate from an empty database. Both databases appear to use a varchar with a limit of 255 for session_id when I look at the table definitions. All examples worked fine with MySQL to this point.
I can of course use SQLLite3 to go through the book, but I’m really trying to understand Rails better, so I’d like to be able to understand a situation like this and how I would go about understanding it and correcting it.
Any ideas what this problem is, and even more importantly, how I would go about understanding what is maybe just a configuration problem without attempting to learn all of Rails?
It looks like it could be something to do with a newer version of Rails - I have 2.3.2 and Ruby 1.8.6, and some of the changes listed in the Prag Prog updates for 2.3 don’t seem to apply (for example, there did not seem to be any line to uncomment as suggested ‘Page 99/107: the line to uncomment in environment.rb now looks as follows: ActionController::Base.session_store = :active_record_store’). Maybe it’s just that I need to be more careful in upgrading to later versions of Rails not assuming forward compatibility, and sticking to one (older) version that is compatible?
Thanks for any suggestions or pointers!
Status: 500 Internal Server Error
Mysql::Error: Data too long for column ‘session_id’ at row 1: INSERT INTO
created_at) VALUES(‘2009-05-05 02:33:42’, ‘BAh7CDoQX2NzcmZfdG9rZW4iMURpUkN2RFFWM0s0c1JRZ1k3NHg2MUlsdHlSUnlXNisyb2MxbUd1dTBsdFU9Og9zZXNzaW9uX2lkIiUwNmY3ZGJjMjVjMjQzMmNhYjM3NDQ1MDdhZWY5N2IzZCIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==–cc1413bb935b8848a4cff4c3af3c7f9e28be7116’, ‘BAh7BzoQX2NzcmZfdG9rZW4iMWxxczdCMXFQL1ArdE9uWk1qU3FWMnJiY0Z0\nNy8zT2gybXFvN2VRdkRvdW89IgpmbGFzaElDOidBY3Rpb25Db250cm9sbGVy\nOjpGbGFzaDo6Rmxhc2hIYXNoewAGOgpAdXNlZHsA\n’, ‘2009-05-05 02:33:42’)