开发者

Apply scope to an association

I have this in a controller:

@apples = Apple.includes(:oranges)

How can I 开发者_如何学编程apply a scope on the oranges?

I've tried everything...


@apples = Apple.joins(:oranges) & Orange.scope

Take a look at the last example from this blog post.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜