子供がいるものを見つけたいです。与えられた:
class Foo < ActiveRecord::Base
has_many :bars
has_many :bazes
scope :is_a_parent ...what goes here?...
バーやベイズがあるFoosを取得したい。確かに、生の SQL ではすべてのことが可能exists (select 1 from bars ...) or exists (select 1 from bazes ...)
ですが、yuk.
確かにany?
arelor
メソッドと組み合わせて使用する方法はありますか? SQLに頼らずにそれを行う他の方法はありますか?