Fixes #7616 - Use validates_lengths_from_database

Note that unfortunately validates_lengths_from_database cannot be applied at a
global level directly against ActiveRecord::Base, since the
validates_length_from_database method requires the class to have a table name
(with the ability to load the schema)
Merge pull request #4680 from daviddavis/temp/20140923164704

Fixes #7616 - Use validates_lengths_from_database