Try this:
scope :engine_parts, lambda { joins(:part_category).merge(PartCategory.engine) }
Basically, the result of joins(:part_category) is the join of two models, so you can’t call .engine on it directly, you need to compose scopes in this manner.
See Here for more