I am trying to add an object to the database like this:
DB.exec("INSERT INTO patients (name, birthdate) VALUES ('#{name}', '#{birthdate}');")
The problem is that if either of these values is nil, the data will be saved incorrectly or there will be a syntax error.
I can use if statements to send a different SQL statement depending on whether or not each value is nil, but this seems ugly and I'm wondering how to do this better.