Sha256: 8ebed8ae9630756a1633adc272288f9d90dce1438f9290e1592f5bf0d05de715

Contents?: true

Size: 409 Bytes

Versions: 3

Compression:

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

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-rspec-4.1.0 spec/models/profile.rb
mongoid-rspec-4.0.1 spec/models/profile.rb
mongoid-rspec-4.0.0 spec/models/profile.rb