When a hash attribute's field is updated via [], changed? returns false

XMLWordPrintableJSON

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

      When a document has a hash field, accessing it via [] and updating a property does not cause changed? to return true. I've been able to reproduce this error, but unable to discover a solution so far.

      To reproduce, place these tests in changeable_spec.rb

      The first one should pass, and the second should fail reproducing the error described above.

      context "when a subfield is changed" do
      
        let(:person) do
          Person.create(map: { name: "value" })
        end
      
        it "returns true" do
          person.map[:name] = "Another Person"
          expect(person).to be_changed
        end
      
        it "returns true if accessed via []" do
          person[:map][:name] = "The Third Person"
          expect(person).to be_changed
        end
      end
      

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

              Created:
              Updated:
              Resolved: