Sha256: 88c56ba70572f1f4e0800da034154fb00c11de6b8782b5ad509f3390c0f87344
Contents?: true
Size: 658 Bytes
Versions: 1
Compression:
Stored size: 658 Bytes
Contents
require 'timespan/mongoid/models/time_period' class Account include Mongoid::Document include Mongoid::Timespanned field :name field :period, :type => ::Timespan, :between => true timespan_methods :period embeds_one :time_period timespan_container_delegates :time_period, :dates, :all 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 to_s # %Q{ # name: #{name} # } # 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timespan-0.5.1 | spec/timespan/mongoid/models/account_3x.rb |