Sha256: dc9d2f7ddad149a829af39c0e9b3f85e0bd36d740b73ac4161bf6624c559e971
Contents?: true
Size: 524 Bytes
Versions: 1
Compression:
Stored size: 524 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
unidom-price-1.2 | app/models/unidom/price/concerns/as_priced.rb |