Sha256: d9739eb50a9146340f50448230c0463a5526f7ae95db143c0d2e5050861c8970
Contents?: true
Size: 548 Bytes
Versions: 7
Compression:
Stored size: 548 Bytes
Contents
module Unidom::Price::Concerns::AsPricer extend ActiveSupport::Concern included do |includer| has_many :pricings, class_name: 'Unidom::Price::Price', as: :pricer def price!(it, amount, at: Time.now) pricing = pricings.priced_is(it).valid_at(now: at).alive.first pricing.soft_destroy if pricing.present? pricings.create! priced: it, amount: amount, opened_at: at end def price?(it, at: Time.now) pricings.priced_is(it).valid_at(now: at).alive.exists? end end module ClassMethods end end
Version data entries
7 entries across 7 versions & 1 rubygems