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.
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.
精彩评论