On Oct 21, 12:27 pm, Jej <[email protected]> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to