tchandy/octopus — pull request #77 by joslynesser (2012-02-17 01:24:27+00:00)
Title: Relaxing scope proxy to work for methods such as .exists?

Currently, `Octopus::ScopeProxy` is very explicit when determining whether to return the result or the proxy itself. Because of being explicit and trying to determine all the possibilities that could be result of the method call, there is room for potential edge cases to sneak in.

One such edge case that currently isn't caught is `.exists?` as shown in the additional spec example. Calling `.exists?` will return true or false, a value that doesn't pass any of the conditions on https://github.com/tchandy/octopus/blob/8558c52430320fb25e146d0ea744084b84f0801a/lib/octopus/scope_proxy.rb#L32

Because of this, it will always return the ScopeProxy instead of true or false. Instead of adding true or false to the possible return values in that long list of conditionals, I opted for the reverse and return everything unless it is an AR relation.

Anyone have any thoughts on a this approach? Should I instead add true or false to the current list of conditions and hope that no other edge cases come up?