I am not sure how hard may be for a newbie to take on functional programming, but if you are interested in new ways of programming, check it out. A more specific article on Ruby: FP with Ruby. If you think in terms of expressions (what things are) instead of statements (update, insert, delete, ...), code is more declarative (and usually shorter). I'll use no regexps to show an alternative approach to the existing answer:
def separate_comma(number)
reverse_digits = number.to_s.chars.to_a.reverse
reverse_digits.each_slice(3).map(&:join).join(",").reverse
end
If you want to support decimals:
def separate_comma(number)
whole, decimal = number.to_s.split(".")
whole_with_commas = whole.chars.to_a.reverse.each_slice(3).map(&:join).join(",").reverse
[whole_with_commas, decimal].compact.join(".")
end