You specify the number of digits after decimal in the precision
option:
<%= number_with_precision(price, precision: 2) %>
number_with_precision
is from ActionView::Helpers::NumberHelper
module. To use it where you don't have this helper available, you need to include this module:
class MyClass
include ActionView::Helpers::NumberHelper
def price_to_number(price)
number_with_precision(price, precision: 2)
end
end