MONGOID-5665 [Monkey Patch Removal] Remove Object#__find_args__ #5706
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes MONGOID-5665
Object#__find_args__
is a kernel monkey patch intended for use inCriteria::Findable
. It prepare arguments for theCriteria.find
method (it's somewhat beguiling name is intended to mean "args for the find method".)Please merge #5702 before this one.
This PR does the following:
Object#__find_args__
to a private method inCriteria::Findable
(now named#prepare_ids_for_find
)__find_args__
was mistakenly called inAtomic#unset
method. Although__find_args__
does a similar thing as what#unset
requires, it is pure coincidence and its usage here is a kludge. So I've inlined the code and made a new private method.__find_args__
for Range previously called to_a. In the case of String, this is actually a bug / DOS risk, because ranges of strings tend to explode when you use to_a. As an example,('64e0'..'64ff').to_a.size => 9320
, and it gets exponentially worse for 24-char BSON ids! Interestingly however, the MongoDB server itself can handle ranges of id strings gracefully, so I am now just passing them into the DB as-is and it magically works--I've added tests. (Range<Numeric, Numeric> is still converted to_a)Set
of IDs as an arg.Overall progress is tracked here: http://tinyurl.com/mongoid-monkey. Refer to MONGOID-5660 for context.