I want to find things that have some children. So given:
class Foo < ActiveRecord::Base
has_many :bars
has_many :bazes
scope :is_a_parent ...what goes here?...
I want to get Foos that have any bars or any bazes. Certainly all things are possible with raw SQL, exists (select 1 from bars ...) or exists (select 1 from bazes ...)
, but yuk.
Surely there's some way to use any?
in conjunction with arel or
method? Some other way to do it without resorting to SQL?