Embedded document class removal causes NameError on old data.

XMLWordPrintableJSON

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

      Perhaps the following change to automatically create a class including MongoId::Document would be a reasonable alternative to the above issue?

      mongoid-2.4.4/lib/mongoid/relations/metadata.rb:

            def klass
              begin
                @klass||= class_name.constantize
              rescue NameError => e
                c = Class.new do
                  include Mongoid::Document
                end
                Kernel.const_set class_name, c
                  
                @klass= class_name.constantize
              end
              @klass
            end
      

              Assignee:
              Unassigned
              Reporter:
              thedracle
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: