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

Issue with polymorphic relation

    • Type: Icon: Task Task
    • Resolution: Done
    • 3.0.7
    • Affects Version/s: None
    • Component/s: None
    • None

      I'm trying to get two parent documents to reference the same child like so:

      class PaymentNotification
        has_many :items, as: :itemable
      end
      
      class Product
        has_many :items, as: :itemable
      end
      
      class Item
        belongs_to :itemable, polymorphic: true
      end
      

      My issue is when I save an Item to a PaymentNotification, it gets removed from the Product that it had previously belonged to (and vice versa).

            Assignee:
            durran Durran Jordan
            Reporter:
            adamyonk adamyonk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: