0
class Customer < ActiveRecord::Base
has_one :address, :foreign_key => "customerid"
end
class Address < ActiveRecord::Base
belongs_to :customer, :foreign_key => "customerid"
end
如何查找在客户中没有customerid地址表中的记录?导轨通过关联查找
在SQL我会做
select * from customer a, address b where a.customerid <> b.customerid