> 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.
>

Actually, I take that back. I updated the patch (still at
http://gist.github.com/360075) and added experimental support for an
alternate not syntax under Ruby 1.9, thanks to BasicObject#!.

>> articles = Article.scoped
>> articles.where(!articles.table[:title].eq('Hello!')).to_sql
=> "SELECT     \"articles\".* FROM       \"articles\" WHERE     (NOT
(\"articles\".\"title\" = 'Hello!'))"
>> articles.where(not(articles.table[:title].eq('Hello!'))).to_sql
=> "SELECT     \"articles\".* FROM       \"articles\" WHERE     (NOT
(\"articles\".\"title\" = 'Hello!'))"

It still passes the same tests it did before, and it seems (in this
case) reasonable to override the boolean not operator like this, to me.

-- 
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.

Reply via email to