active record problem

so0ly wrote:

i'm having 2 tables:
TABLE A
--------
id
name
b_id #id from TABLE B

------------------------------
TABLE B
--------
id
name

the problem is i want all the objects form table b where there's no record for in table a.

B.find( :all,
         :select => 'b.*',
         :joins => 'left join a on b.id = a.b_id',
         :conditions => 'a.b_id is null' )