balderdashy/sails — pull request #358 by particlebanana (2013-04-27 17:04:20+00:00)
Title: Fixes #310 error with defaultsTo not being set correctly

This should fix #310 I believe. I ran into the issue where a boolean value of 0 for the defaultsTo was not being set correctly.

The problem is that the line `if (_.isObject(scheme) && scheme.defaultsTo)` requires the defaultsTo value to evaluate to true. In reality it evaluates to either undefined or the default value.

It should also fix the issue where the defaultsTo value was being set even if a value was passed in.

I added some more tests to the `defaultsTo.test.js` file as well to test everything is working as expected.