开发者

Apply scope to an association

开发者 https://www.devze.com 2023-02-25 02:12 出处:网络
I have this in a controller: @apples = Apple.includes(:oranges) How can I 开发者_如何学编程apply a scope on the oranges?

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

精彩评论

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