Sha256: 194a2a3428c84d468498a42bb702caf287116c98d5d8a6ca52f65ded914cc347

Contents?: true

Size: 379 Bytes

Versions: 1

Compression:

Stored size: 379 Bytes

Contents

class Account
  include Mongoid::Document
  include Mongoid::Timespanned

  field :period, :type => ::Timespan, :between => true

  timespan_methods :period

  def self.create_it! duration
    t = ::Timespan.new(duration: duration)
    self.new period: t
  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.4.3 spec/timespan/mongoid/models/account_3x.rb