Closed joel-nyansa closed 6 years ago
And if you move store_in
above that track_history
does it change anything? Either way I think it's a bug and the scope should include the target collection. Try PRing a full spec and maybe a fix, I can try helping with that too.
@dblock yes, that fixes it. I can PR a fix that substitutes class name as the key instead of collection, but the tests wont pass. The other solution I was thinking is to store the options on the class itself but I think that messes with inheritance.
The end goal is to have a set-and-forget module that can be included anywhere, and ideally everywhere to track every change.
I think storing options on the class itself is the way to go, and it can use class level attributes that are copied on inheritance but become local to the child class when modified. I am not saying it's easy, but you'll be my hero if you can make it work :)
It's going to break some tests. I'll code it up and report back.
=>
It looks like a result of this line which hashes the configuration by collection name. I tried adjusting it to hash by class name and search for any ancestor with a configuration (for inheritance) but it broke a bunch of tests.