Sha256: 11f450f68f32864f4c151d45bb1c0ba5c1a88fd7fdcee1ce1151805ac6d67daa

Contents?: true

Size: 673 Bytes

Versions: 18

Compression:

Stored size: 673 Bytes

Contents

# frozen_string_literal: true

module Mongoid
  module Errors

    # This error is raised when trying to set a value in Mongoid that is not
    # already set with dynamic attributes or the field is not defined.
    class UnknownAttribute < MongoidError

      # Create the new error.
      #
      # @example Instantiate the error.
      #   UnknownAttribute.new(Person, "gender")
      #
      # @param [ Class ] klass The model class.
      # @param [ String | Symbol ] name The name of the attribute.
      def initialize(klass, name)
        super(
          compose_message("unknown_attribute", { klass: klass.name, name: name })
        )
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mongoid-8.1.9 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.9 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.8 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.7 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.6 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.8 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.5 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.4 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.7 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.3 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.2 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.6 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.1 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.5 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.1.0 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.4 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.3 lib/mongoid/errors/unknown_attribute.rb
mongoid-8.0.2 lib/mongoid/errors/unknown_attribute.rb