Sha256: 05c85a9b2076b9af507cc83cb37bb3c1f154cbce67a9733f4891046d9917e773

Contents?: true

Size: 401 Bytes

Versions: 1

Compression:

Stored size: 401 Bytes

Contents

class Message
  include Mongoid::Document

  field :identifier
  field :from
  field :to

  if Mongoid::Compatibility::Version.mongoid6_or_newer?
    belongs_to :user, optional: true
  else
    belongs_to :user
  end

  validates :identifier, uniqueness: { message: 'uniqueness' }
  validates :from, presence: { message: 'required' }
  validates :to, format: { with: /[a-z]+/, message: 'format' }
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-rspec-4.1.0 spec/models/message.rb