Post.all('user.name' => 'merborne')
のように簡単に行くけど
many to manyの場合はちょっと面倒
Post.all(:conditions => {:id => PostTag.all(:tag_id => 3).map { |pt| pt.post_id }})
つまりRelationTableを使ってやる必要がある
No comments:
Post a Comment