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