タグ付けされた質問 「meta-where」

8
Railsで関連するレコードのないレコードを検索したい
単純な関連付けを検討してください... class Person has_many :friends end class Friend belongs_to :person end ARelやmeta_whereに友達がいないすべての人を取得する最もクリーンな方法は何ですか? そして、has_many:throughバージョンはどうですか? class Person has_many :contacts has_many :friends, :through => :contacts, :uniq => true end class Friend has_many :contacts has_many :people, :through => :contacts, :uniq => true end class Contact belongs_to :friend belongs_to :person end 私は本当にcounter_cacheを使いたくない-そして私が読んだことから私はそれがhas_many:throughで動作しない すべてのperson.friendsレコードをプルしてRubyでループ処理したくない-meta_search gemで使用できるクエリ/スコープが欲しい クエリのパフォーマンスコストは気にしません …
弊社のサイトを使用することにより、あなたは弊社のクッキーポリシーおよびプライバシーポリシーを読み、理解したものとみなされます。
Licensed under cc by-sa 3.0 with attribution required.