attr_json
attr_json copied to clipboard
an array type of models does weird things on nil
attr_json :models, some_model_class_type, array: true
And then
instance.models = [nil]
instance.save!
Does weird and unexpected things -- in some cases raising unexpectedly with a convoluted stack trace.
Not sure what it should do. Either allow the nil through, or compact and remove it? Or should this be an option on array type?
For arrays of primitive types, trying to put a nil in there may not raise, looks like it usually passes through and allows it. Is that ok/expected?