Sha256: acbe93c39b1cc08088ade31090b457c054af537723d96fbbb0aca0ad1a2aef50

Contents?: true

Size: 333 Bytes

Versions: 9

Compression:

Stored size: 333 Bytes

Contents

class Post
  include Mongoid::Document
  include Mongoid::Versioning
  include Mongoid::Timestamps
  field :title
  belongs_to_related :person

  named_scope :recent, where(:created_at => { "$lt" => Time.now, "$gt" => 30.days.ago })

  class << self
    def old
      where(:created_at => { "$lt" => 30.days.ago })
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 spec/models/post.rb
mongoid-2.0.0.alpha spec/models/post.rb
mongoid-1.2.14 spec/models/post.rb
mongoid-1.2.13 spec/models/post.rb
mongoid-1.2.12 spec/models/post.rb
mongoid-1.2.11 spec/models/post.rb
mongoid-1.2.10 spec/models/post.rb
mongoid-1.2.9 spec/models/post.rb
mongoid-1.2.8 spec/models/post.rb