-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:
The test for the return value in the reset_attribute! method in lib/mongoid/dirty.rb prevents newly set values from being reset. This is because their previous value will be nil, and cause if block to fail.
Here is a spec example I've written to test this.
http://gist.github.com/500947
The problem is, it seems that the test of value in that method is used to allow the current spec tests to pass, since the Document objects are created using Person.new(:title => "Grand Poobah") instead of create or even saving the document. So it seems that to have the initializer values appear as not 'dirty' they have the reset_attribute! method leave previously unset values alone.
This to me seems rather backwards, since changing something from nil to a new value is a valid change, and should be reversible. But if I make the change to remove the test, then other specs fail because of the poor test assumption. I'd submit this patch, but I wanted to pass this onto the group.