Sha256: c7f2a5221f8dab83a27cd13cf961859b50624e58d080f6668cf82e672af5c798
Contents?: true
Size: 603 Bytes
Versions: 2
Compression:
Stored size: 603 Bytes
Contents
require 'timespan/mongoid/models/time_period' class Account include Mongoid::Document include Mongoid::Timespanned field :period, :type => ::Timespan, :between => true timespan_methods :period embeds_one :time_period timespan_container_delegates :time_period, :dates, :all #:start, :end def self.create_it! duration acc = self.new period: ::Timespan.new(duration: duration), time_period: ::TimePeriod.new acc.time_period.dates_duration = 1.day acc end def self.between from, to Account.where(:'period.from'.gt => from.to_i, :'period.to'.lte => to.to_i) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
timespan-0.4.6 | spec/timespan/mongoid/models/account_3x.rb |
timespan-0.4.5 | spec/timespan/mongoid/models/account_3x.rb |