Sha256: 6f7201c0181d74aa087955582a5e10b5dad146292617168bee5d36ef70b3ca08

Contents?: true

Size: 315 Bytes

Versions: 19

Compression:

Stored size: 315 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

19 entries across 19 versions & 1 rubygems

Version Path
timespan-0.6.0 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.9 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.7 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.6.1 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.6 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.5 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.4 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.3 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.2 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.1 spec/timespan/mongoid/models/account_2x.rb
timespan-0.5.0 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.9 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.6 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.5 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.4 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.3 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.2 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.1 spec/timespan/mongoid/models/account_2x.rb
timespan-0.4.0 spec/timespan/mongoid/models/account_2x.rb