I added allow_nil option to String type so it works similar to numeric types. Because there is no reason why you should forbid nil values in string fields.
Inverted logic of allow_nil because when you have such class
class A
include ShallowAttributes
attribute :a, Integer, allow_nil: true
end
and you initializing a with nil
A.new(a: nil)
you expect it's value to be nil, cause you specifically wrote allow_nil: true in class definition.
But currently it has 0 value.
Coverage increased (+0.0007%) to 99.879% when pulling 2885c3ab6ca1063b9aabea7942f912b981608206 on morr:nil-strings into 37fe19415397c78fcc40c562ea6b0b0b7c47cb16 on davydovanton:master.
I added
allow_nil
option toString
type so it works similar to numeric types. Because there is no reason why you should forbid nil values in string fields.Inverted logic of
allow_nil
because when you have such classand you initializing
a
withnil
you expect it's value to be
nil
, cause you specifically wroteallow_nil: true
in class definition. But currently it has0
value.