byroot / activerecord-typedstore

ActiveRecord::Store but with type definition
MIT License
439 stars 57 forks source link

non-nullable value without default #41

Open jhjwind opened 8 years ago

jhjwind commented 8 years ago

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!

byroot commented 8 years ago

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?

jhjwind commented 8 years ago

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