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

Cannot clone a model instance that embeds another model which uses inheritance and is inheritance root

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.2.0.rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible

      class Foo
          include Mongoid::Document
      end
      
      class Bar < Foo
      end
      
      class Top
          include Mongoid::Document
          embeds_many :foos
      end
      
      Top.new(foos: [Foo.new]).clone
      

      Result:

      NoMethodError (undefined method `localized_fields' for nil:NilClass)
      

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

              Created:
              Updated:
              Resolved: