Formatting a price string
Code review-wise, I'd avoid long if-elsif chains and see about converting them to a case. Also, I'd move the final formatting to the end. Otherwise, not too bad except for the fact that there are much more concise ways to do this.

One is to notice that if you go from the end of the string backwards, there are fewer cases. In fact, just one:

def price_formatter(price)
  "$" + price.reverse.scan(/.{1,3}/).join(',').reverse
end


This reverses the string, looks for groups of up to 3 and joins them with commas, then reverses back.

You may have suspected that there might be a single regex that can do the trick. You would be correct:

def price_formatter(price)
  "$" + price.gsub(/(\d)(?=\d{3}+(\.\d*)?$)/, '\1,')
end


It's a little more obtuse in my opinion.

If you happen to be using Rails, I'd use the built-in helper:

def price_formatter(price)
  number_to_currency(price)
end


There are more options to number_to_currency, but the default is the output you want. In fact you are just recreating it, so you could refactor your method away completely.

Note you need to add return if price.nil? to handle the nil case in all the above.