1
我有三個表:users
,locations
,locations_users
,該協會如下:如何在rails中簡單地加入n對n的關聯?
user has_many locations_users
user has_many locations :through => locations_users
location has_many locations_users
location has_many users :through => locations_users
我怎麼會找到所有誰是加入了一個查詢LOCATION_ID = 5的用戶?
任何幫助,將不勝感激。
你大概的意思'或'設置而不是標準中的「AND」。 –
是的。糾正。 – maicher
這個答案是最適合這個問題的,但左連接速度很慢 – emrahbasman