[ACCEPTED]-Using a scope from a related model in another scope-activerecord
Accepted answer
Try this:
scope :engine_parts, lambda { joins(:part_category).merge(PartCategory.engine) }
Basically, the result of joins(:part_category)
is the 3 join of two models, so you can't call .engine
on 2 it directly, you need to compose scopes 1 in this manner.
See Here for more
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.