But why?

This technique improves the organisation of your code. It forces you to do two things that can really help keep you productive over time.

Firstly: naming the concepts you’re creating. When you name something aptly, you explain it, often for the benefit of “future you” or your colleagues.

Secondly: you have one place to look for all of this. If you define scopes outside your models you can end up with arbitrary scopes and conditions defined all over your code base. When you know where all the conditions are defined you’ll know where to look when you want to refactor or optimise database performance.

Why not?

For scopes involving #limit, simple #orders or pagination, there’s very little point in bothering to create specific scopes, as the syntax of the ActiveRelation methods are quite succinct.

Naming scopes is only beneficial when you gain extra clarity. Sometimes, with non-#where queries, there is no enhanced understanding from wrapping simple ActiveRelation methods inside a scope.