开发者

rails equivalent of sql 'in ' operator

let's say that we have models, A, B, and C

A is 1:N to B

B is 1:N to C

How would I use a query开发者_开发百科 to return the subset of C such that the owner of each C is one of the Bs owned by A?

essentially How to specify multiple values in where with AR query interface in rails3 but that's unanswered


You have to do a :through association:

A has_one C, :through => B

and then you would be able to do A.C

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜