Sha256: dff4c0f18ce0d4532fe369d2092eaf14d841a1b7fb122d570d9bff0095cf9501

Contents?: true

Size: 332 Bytes

Versions: 10

Compression:

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

10 entries across 10 versions & 2 rubygems

Version Path
mongoid-1.2.7 spec/models/post.rb
mongoid-pre-2.0.0.pre spec/models/post.rb
mongoid-1.2.6 spec/models/post.rb
mongoid-1.2.5 spec/models/post.rb
mongoid-1.2.4 spec/models/post.rb
mongoid-1.2.3 spec/models/post.rb
mongoid-1.2.2 spec/models/post.rb
mongoid-1.2.1 spec/models/post.rb
mongoid-1.2.0 spec/models/post.rb
mongoid-1.1.4 spec/models/post.rb