square/rails — pull request #20 by strzalek (2014-04-09 15:51:55+00:00)
Title: Fix validates_length_of

When you declare `validates_length_of` without `: minimum` and with `:allow_nil => false` it will return `true` on `nil` values. This bug wasn't fixed up until [4.0 release](https://github.com/rails/rails/commit/ea76e9a3126998578d683783483aa695cb6b657e)

We're using such combination in one place. While it can be fixed just by adding `:minimum => 1` to validator it will be very hard for debug. What's even worst, when model's validations aren't tested thoroughly with assumption that they just work as supposed it will be hidden bug.

I've back ported the fix.

/cc @JackDanger @tamird @robolson