I don't understand the following example from the ActiveRecord::Base section in http://api.rubyonrails.org/ :
I’m not sure exactly why, but it is true, the error doesn’t get thrown until you try to retrieve it. Part of the issue is that the serialize method creates a uniquely ruby construct, to the database it’s a text field. Therefore, when you save the record, unless there’s logic on the Rails side, there isn’t going to be an error from the database from a mismatch.
I’m not fond of serialization for that reason, because you can’t initialize the hashes or whatever you store there, and, by definition, it’s limited to 64K (the limit of a text field). Rails 4 now has the store which, IMO, is better if it meets your needs. Also, PostgreSQL now supports hash, array, and json column types (I think you need PostgreSQL 9.2 or later).