Hotfix for Rails bug with NaN integer column values

See rails/rails#8757 - After the 'rescue' truthiness check was removed from integer column casting in 3.2.9 (which itself was a bug causing incorrect default values from Flash NaNs), this bug appeared raising an exception when NaN.to_i is called.

The temporary fix is to convert all NaN to nil which is correctly interpreted by Rails. This is what they end up being anyway, since the database adapter will convert NaN to NULL in all cases I know of.