Sha256: b0d9baf910af96096c8962c2601352ae59a951a222ebea00b69d36887e47b38d

Contents?: true

Size: 323 Bytes

Versions: 1

Compression:

Stored size: 323 Bytes

Contents

module Workarea
  decorate Pricing::Price, with: :flow_io do
    decorated do
      before_validation :guard_negative_prices
    end

    def guard_negative_prices
      if regular < 0
        self.regular = regular.abs
      end

      if sale.present? && sale < 0
        self.sale = sale.abs
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-flow_io-1.2.1 app/models/workarea/pricing/price.decorator