On Apr 8, 9:47 pm, "Joe Smith" <[email protected]> wrote: > > That breaks left to right readability pretty badly. I really would like a > better solution for negating predicates and predicate chains, but I'm not > sure what.
I agree that I don't much like the way it just dangles there like that, but I don't see any other way to accomplish what's desired. In working with it, I find that it helps to imagine yourself back in the 90s for a moment. "User name equals Bill or user name equals Ted... NOT!" OK, maybe I'm just odd. Or maybe the method name needs an exclamation point. :) In all seriousness, though, it's not much different than something like String#reverse. > > You probably should also have the README file patched to indicate that AND > and OR are implemented The AND and OR the README refers to have been implemented for some time. > > Also, I'm not sure how of :notmatches_any and :notmatches_all will react. > Will the negation be applied before or after the combining? Negation is on the predicate. notmatches_any will give you a predicate something like: (users.name NOT LIKE '%Joe%' OR users.name NOT LIKE '%Bob%) The additional NOT would negate the whole thing: NOT (users.name NOT LIKE '%Joe%' OR users.name NOT LIKE '%Bob%) > > Also if you have a _any and _all prefix, should you not also include a > _none, too? I don't necessarily think so, though I could add it if others think otherwise. _none is the same as _any and not combined, and in the SQL engine I'd say that's exactly how it'd have to be implemented, too. > > Also is ".not" in use out in the wild already? How will existing code react? > Will it error out indicating that the new .not toes not take parameters? The previous .not was a method on Arel::Attribute, not Arel::Predicate -- I just renamed it to noteq because of the potential for exactly that kind of confusion and for internal consistency . I'm not sure what else out there is currently using Arel besides ActiveRecord, and a search of the current source shows no use of Attribute#not in there. It also only hit master on March 12th -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
