DEV Community


Discussion on: I don't use nil

afrodevgirl profile image
Alexis Moody

I tend to agree that if you can control the schema it's best to have as few empty values as possible. But rails apps are often complex and can contain a number of integrations where the data shape can be variable. So I often find myself using &. and a combination of .blank? and .present? to ensure I don't have nil method errors. Personally, I'd rather be defensive most of the time so my programming brain does less context switching between languages. That said, I always support whatever delivers great value to users :)