Sha256: af6ebba466cc7e6cb54e597463dced187b32a0b9e4283a2657897a728df9e1a9

Contents?: true

Size: 619 Bytes

Versions: 18

Compression:

Stored size: 619 Bytes

Contents

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

    # Raised when trying to get or set a value for a defined field, where the
    # type of the object does not match the defined field type.
    #
    # Example:
    #
    # <tt>InvalidType.new(Array, "Not an Array")</tt>
    class InvalidType < MongoidError
      def initialize(klass, value)
        super(
          translate(
            "invalid_type",
            {
              :klass => klass.name,
              :other => value.class.name,
              :value => value.inspect
            }
          )
        )
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.2 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.1 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.8 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.7 lib/mongoid/errors/invalid_type.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.6 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.5 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.4 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.3 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.2 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.rc.1 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.beta.20 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.beta.19 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.beta.18 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.beta.17 lib/mongoid/errors/invalid_type.rb
mongoid-2.0.0.beta.16 lib/mongoid/errors/invalid_type.rb