Make MissingAttributeError more informative

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: 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
            Reporter:
            Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: