NoMethodError: undefined method `errors' for nil:NilClass on create!

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • 5.0.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Using Mongoid 3.1.4

      Receive "NoMethodError: undefined method `errors' for nil:NilClass" when calling Model.create!(attributes)

      It's coming from line 277 in persistence.rb:

        fail_validate!(doc) unless doc.insert.errors.empty?
      

      So presumably doc.insert is nil. How could that be possible? Seems like a mongoid bug.

              Assignee:
              Emily Stolfo (Inactive)
              Reporter:
              jeremyhaile
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: