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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 7.2.0.rc1
    • None
    • None
    • Fully Compatible

    Description

      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)
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: