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