Sha256: 5ab64e07c1009eeb478274bf267628d7de61b73198bc565d40bf19595d906d4e

Contents?: true

Size: 646 Bytes

Versions: 5

Compression:

Stored size: 646 Bytes

Contents

class Article
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Paranoia
  include Mongoid::Versioning
  include Mongoid::MultiParameterAttributes

  field :title
  field :content
  field :published, :type => Boolean, :default => false
  field :allow_comments, :type => Boolean, :default => true

  embeds_many :comments
  embeds_one :permalink
  belongs_to :author, :class_name => 'User', :inverse_of => :articles, :index => true

  validates :title, :presence => true

  validates_length_of :title, :minimum => 8, :maximum => 16

  index({ title: 1 }, { unique: true, background: true })
  index({ published: 1 })
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mongoid-rspec-1.5.4 spec/models/article.rb
mongoid-rspec-1.5.3 spec/models/article.rb
mongoid-rspec-1.5.1 spec/models/article.rb
mongoid-rspec-1.5.0 spec/models/article.rb
mongoid-rspec-1.4.6 spec/models/article.rb