Ruby on Rails Sum nil

items.map(&:sale_price).compact.sum
# or
items.map(&:sale_price).sum(&:to_i)
patrick204nqh