I have a question for you.
In my application, I want to make sure that the database doesn’t have
any NULLs in fields.
I can’t use validates_presence_of, because it will puke if there’s an
empty string ("")
So… is there an EASY way to check if a list of fields is null?
Right now, I’m doing:
errors.add(:mailing_middle_name, “cannot be nil”) if
errors.add(:company, “cannot be nil”) if company.nil?
errors.add(:address_line_2, “cannot be nil”) if
But it’s ugly.
Plus, I realise that passing “nil” is a nice way NOT to specify every
single value when you update a record.
So… to expand my previous question, is there a way to prevent nil
values when an object is CREATED, but then allow them (which measn
“don’t touch whatever is there”) when it’s updated?
Am I missing something very obvious?