Sha256: 86c521468ba7821f94734d58a763f6b23fc3a0950c9c6c529687a02d6d73dc00

Contents?: true

Size: 607 Bytes

Versions: 188

Compression:

Stored size: 607 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc
  module Errors #:nodoc

    # Raised when a persistence method ending in ! fails validation. The message
    # will contain the full error messages from the +Document+ in question.
    #
    # @example Create the error.
    #   Validations.new(person.errors)
    class Validations < MongoidError
      attr_reader :document
      def initialize(document)
        @document = document
        super(
          translate(
            "validations",
            { :errors => document.errors.full_messages.join(", ") }
          )
        )
      end
    end
  end
end

Version data entries

188 entries across 96 versions & 4 rubygems

Version Path
mongoid-2.1.7 lib/mongoid/errors/validations.rb
mongoid-2.1.6 lib/mongoid/errors/validations.rb
mongoid-2.1.5 lib/mongoid/errors/validations.rb
mongoid-2.1.4 lib/mongoid/errors/validations.rb
mongoid-2.1.3 lib/mongoid/errors/validations.rb
mongoid-2.1.2 lib/mongoid/errors/validations.rb
mongoid-2.1.1 lib/mongoid/errors/validations.rb
mongoid-2.1.0 lib/mongoid/errors/validations.rb