money-rails - rounding up method

327 Views Asked by At

I have this method below:

  def formatted_from_net_per_day
    return unless object.price.available?
    formatted_price_for(object.price.from_price)
  end

As an example, it outputs:

#<Money fractional:78571 currency:GBP>

The formatted_price_for method is as below where it strips away the cents.

  def formatted_price_for(price)
    formatted_price = h.money_without_cents_and_with_symbol(price)
    unit = I18n.t("space.pricings.pricing.day")

    format('%s/%s', formatted_price, unit)
  end

Instead of stripping the cents away, I want to round up the money and retain the currency. So using the example output above - £785.71 -> £786

How can I achieve that?

0

There are 0 best solutions below