Fix trying to check type for nil column

Sometimes column to check passed to `type_cast_attribute_for_write` is `nil`.
This kind of protection is implemented in ActiveRecord as well.