Thanks to everyone for the quick response. The Integer suggestion works
great, but I'll point out one wrinkle that I encountered:

Integer nil # => 0

That was a small surprise. (These zeros keep popping up when you may
not expect them!) My little conversion method now works fine and looks
like this:

  def string_to_i(str)
    if str.nil? then return nil else Integer str end
  rescue nil
  end