Sha256: 4e61b866cd38518c31191dc20d586baf6b206b0cd88443ab1f1504ae234beca8

Contents?: true

Size: 310 Bytes

Versions: 2

Compression:

Stored size: 310 Bytes

Contents

class Account
	include Mongoid::Document  
	field :period, :type => TimeSpan, :between => true

  def self.create_it! duration
    s = self.new
    s.period = {duration: duration}
    s
  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.3.2 spec/timespan/mongoid/account.rb
timespan-0.3.1 spec/timespan/mongoid/account.rb