attr_json icon indicating copy to clipboard operation
attr_json copied to clipboard

an array type of models does weird things on nil

Open jrochkind opened this issue 4 years ago • 0 comments

 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?

jrochkind avatar Feb 24 '21 16:02 jrochkind