Sha256: fd98745de747bafdf6aa979c26fbd7a20c9ec4c0b1c18dadbec559c1efe28313

Contents?: true

Size: 699 Bytes

Versions: 22

Compression:

Stored size: 699 Bytes

Contents

class Post
  include Mongoid::Document
  include Mongoid::MultiParameterAttributes
  include Mongoid::Versioning
  include Mongoid::Timestamps

  field :title, :type => String
  field :content, :type => String
  field :rating, :type => Integer

  belongs_to :person
  belongs_to :author, :foreign_key => :author_id, :class_name => "User"
  has_and_belongs_to_many :tags
  has_many :videos, :validate => false

  scope :recent, where(:created_at => { "$lt" => Time.now, "$gt" => 30.days.ago })
  scope :posting, where(:content.in => [ "Posting" ])

  validates_format_of :title, :without => /\$\$\$/

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

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
mongoid_spacial-0.2.17 spec/models/post.rb
sig_mongoid_spacial-0.2.17 spec/models/post.rb
cb_mongoid_spacial-0.2.16 spec/models/post.rb
mongoid_geospatial-1.0.0 spec/models/post.rb
mongoid_geospatial-1.0.0rc1 spec/models/post.rb
mongoid_geospatial-1.0.0rc0 spec/models/post.rb
mongoid_spacial-0.2.16 spec/models/post.rb
mongoid_spacial-0.2.13 spec/models/post.rb
mongoid_spacial-0.2.12 spec/models/post.rb
mongoid_spacial-0.2.11 spec/models/post.rb
mongoid_spacial-0.2.10 spec/models/post.rb
mongoid_spacial-0.2.8 spec/models/post.rb
mongoid_spacial-0.2.7 spec/models/post.rb
mongoid_spacial-0.2.6 spec/models/post.rb
mongoid_spacial-0.2.5 spec/models/post.rb
mongoid_spacial-0.2.4 spec/models/post.rb
mongoid_spacial-0.2.3 spec/models/post.rb
mongoid_spacial-0.2.2 spec/models/post.rb
mongoid_spacial-0.2.0 spec/models/post.rb
mongoid_spacial-0.1.1 spec/models/post.rb