Simplify with inject:

def sum(list)
  list.inject(0){|sum, x| sum +x}
end