Polymorphic association resolver is nil

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: 9.0.7
    • Component/s: None
    • None
    • 🔵 Done
    • Ruby Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      After upgrading Mongoid to 9, I'm intermittently getting the following exception:

      undefined method 'model_for' for nil

      when accessing a polymorphic relation. It seems the problem is [here](https://github.com/jamis/mongoid/blob/7a8ffbb06cd3349de95decca824327975cbe40f4/lib/mongoid/association/accessors.rb#L46) and it's extremely difficult to reproduce it (I only managed locally once, after adding debug output to mongoid gem and restarting the server, couldn't reproduce it again yet).

      Maybe something with the mutex-instantiating the resolver?

            Assignee:
            Jamis Buck
            Reporter:
            Marek Stanczyk
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: