I agree that a double negative is iffy. But I don't like present on the 
root. What I do like is: Person.where.present(:name) – so that #present on 
where becomes a modifier like #not. I would have to have the same semantics 
as Object#present?, though. So that means that both nil and empty would 
count. (Also agree that we can't use #having since it already has meaning 
in SQL).

On Wednesday, December 5, 2018 at 3:30:12 PM UTC-8, Matt Norton wrote:
>
> Instead of:
> Person.where.not(name: nil)
>
> Use:
> Person.present(:name)
>
> Avoids double negative and verbosity.
>
> I'd be happy to contribute if there's interest in this! 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to