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

Make MissingAttributeError more informative

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      As reported in https://jira.mongodb.org/browse/MONGOID-5306, when MissingAttributeError is raised, it does not report which model class was referenced:

      serene2% mongoid=master rake test_5306
      rake aborted!
      ActiveModel::MissingAttributeError: Missing attribute: 'address'
      
                raise ActiveModel::MissingAttributeError, "Missing attribute: '#{field_name}'"
      

      To make troubleshooting easier the exception should specify at least the model class (and possibly an inspection of the model truncated to some reasonable length).

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

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None