On Oct 21, 12:27 pm, Jej <j...-GANU6spQydw@public.gmane.org>
wrote:> Hi all,
>
> I don''t understand why this does not work:
>
> Model.all(:conditions => ["first_category_id = ?", nil]) or
Model.all
> (:conditions => "first_category_id = NULL")
>
> to get all records having NULL in first_category_id.
>
> This works instead:
>
> Model.all(:conditions => "first_category_id IS NULL")
>
> I wonder why it''s not possible to use the activerecord way?
It does work if you use the hash form of conditions ( ie conditions =>
{:first_category_id => foo} )
Fred>
> Is there a proper way to get all records that have or miss a
> relationship?
>
> Cheers,
> Jej