Sha256: 27091825f8aa9c9b4631d1422327b44c45f342bdda4d62c74b59edd6e4f1d4f0

Contents?: true

Size: 413 Bytes

Versions: 13

Compression:

Stored size: 413 Bytes

Contents

class Profile
  include Mongoid::Document

  field :first_name
  field :last_name
  field :age
  field :hobbies, type: Array, default: []

  embedded_in :user, inverse_of: :profile

  validates :age, numericality: { greater_than: 0 }
  validates :terms_of_service, acceptance: true
  validates :hobbies, length: { minimum: 1, message: "requires at least one hobby" }

  index({ first_name: 1, last_name: 1 })
end

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
mongoid-spec-4.0.1 spec/models/profile.rb
mongoid-rspec-3.0.0 spec/models/profile.rb
mongoid-rspec-2.2.0 spec/models/profile.rb
mongoid-rspec-2.1.0 spec/models/profile.rb
mongoid-rspec-1.13.0 spec/models/profile.rb
mongoid-rspec-2.0.0 spec/models/profile.rb
mongoid-rspec-2.0.0.rc1 spec/models/profile.rb
glebtv-mongoid-rspec-3.0.0 spec/models/profile.rb
mongoid4-rspec-1.11.0 spec/models/profile.rb
glebtv-mongoid-rspec-1.12.0 spec/models/profile.rb
mongoid-rspec-1.11.0 spec/models/profile.rb
mongoid-rspec-1.10.0 spec/models/profile.rb
mongoid-rspec-1.9.0 spec/models/profile.rb