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

Add Feature Flag: Reloading retains stale changed value

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Critical - P2 Critical - P2
    • 7.4.0
    • Affects Version/s: None
    • Component/s: Attributes
    • Fully Compatible

      In testing for MONGOID-5199 neil.shweky found the following curious case:

      Band.with_session do |s|
        s.start_transaction
      
        label = Label.new(name: "Neil")
        b = Band.new(label: label)
        b.save!
        b.label = nil
        b.label = label
        b.reload
        puts b.label # nil
      
        s.commit_transaction
      end
      

      This code appears to print a stale changed value, which regardless of whether reload should reset attribute changes does not appear to be correct.

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

              Created:
              Updated:
              Resolved: