activerecord-typedstore icon indicating copy to clipboard operation
activerecord-typedstore copied to clipboard

non-nullable value without default

Open jhjwind opened this issue 9 years ago • 2 comments

I expected non-nullable value without default would raise an exception if trying to save null value. However it's not the case and there's no test coverage. I am wonder what the expected behavior should be. Thanks!

jhjwind avatar Mar 15 '16 19:03 jhjwind

I agree it should raise, but not sure if it should raise when you try to assign nil or when you define an attribute as non-nullable without a default.

The problem with the latter is that what do you do with the old serialized records if the current declaration doesn't match anymore?

byroot avatar Mar 15 '16 20:03 byroot

I think it probably should raise exception if save nil when null: false or save blank when blank: false is defined.

jhjwind avatar Mar 15 '16 22:03 jhjwind