Named_scope on has_many, find all records that don't have elements in that association

I have a Customer model that has_many :addresses, is there a way (via
named scope or any other method that’s … ehm … model side) to
obtain all the Customers that don’t have any addresses at all (for
which the associated array would be empty)?

Thank you for the answer…

Thinking in SQL, you want to do this:

select * from customers left outer join addresses on
customers.address_id =
where is null.

First thing that comes to mind here something like:
Customer.find(:all, :include => :address, :conditions => ‘
is null’)

hope that helps,

On Jan 11, 5:32 pm, Gabriele T. [email protected]