dynamoid
dynamoid copied to clipboard
Not Functioning Correctly on Partial Updates of Serialized Fields
It seems that changing the value of the serialized field called "options" does not set "changed?" to true. It works correctly when the entire "options" field is modified.
Is this the expected behavior?
Reproduction
Dynamoid: v3.9.0 Ruby: 3.3.0
Sample Test
context 'serialized field' do
let(:model) do
new_class do
field :options, :serialized
end
end
it 'returns true if serialized field has unsaved changes' do
obj = model.new(options: {})
expect(obj.changed?).to eq true
obj = model.create(options: {})
obj.options['name'] = 'Alex'
expect(obj.changed?).to eq true
end
it 'returns true if serialized field has unsaved changes other object ' do
obj = model.new(options: {})
expect(obj.changed?).to eq true
obj = model.create(options: {})
obj.options = {'name' => 'Alex'}
expect(obj.changed?).to eq true
end
end