Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-5055

UnknownAttribute error has broken grammar

    • Fully Compatible

      The message produced is as follows:

      Mongoid::Errors::UnknownAttribute in LogosController#create
      message:
      Attempted to set a value for 'image' which is not allowed on the model Logo.
      summary:
      Without including Mongoid::Attributes::Dynamic in your model and the attribute does not already exist in the attributes hash, attempting to call Logo#image= for it is not allowed. This is also triggered by passing the attribute to any method that accepts an attributes hash, and is raised instead of getting a NoMethodError.
      resolution:
      You can include Mongoid::Attributes::Dynamic if you expect to be writing values for undefined fields often.

      Suggested replacement:

      Mongoid::Errors::UnknownAttribute in LogosController#create
      message:
      Attempted to set a value for 'image' which is not allowed on the model Logo.
      summary:
      Logo#image= was called to set a value for the 'image' attribute but there is no 'image' field defined and Mongoid::Attributes::Dynamic is not included in the model. This error is also triggered if the unknown attribute is passed to any method that accepts an attributes hash, such as Logo#attributes=, and is raised instead of NoMethodError.
      resolution:
      Explicitly define the field 'image' in Logo or include Mongoid::Attributes::Dynamic if you expect to be storing values in fields that are not explicitly defined often.

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: