Rails migration: is it possible to use 'nil' as the default value for a boolean field?

Is there anything wrong with the fact that by default for a boolean field , ActiveRecord migration is used nilinstead falsefor use with Postgres?

I like the way it gives a small bit of extra data - regardless of whether this field is marked as true or false.

+5
source share
1 answer

there is nothing that would prevent you from using nil in boolean - but to me personally, like my booleans, were true or false, I found that nil can lead to some ugly code

+7
source

All Articles