- DRY: Scopes must be defined only in the "scopes" method or in their own methods (for parameterized ones). In the method "defaultScope", there should be only a reference to a previously declared scope.
- Resetting: Ability to reset only selected scopes. This improves maintanability. The motivation for this is that you can't specify a scope that disables a default scope*. Having the ability to disable only a selected scope improves maintanability because it is not needed to review/change every query where scopes are reset.
* You can't specify the scopes "active" and "inactive" in the same query, since the resulting query will have something like this: "WHERE active = 1 AND active = 0". Another proposal would be to have something like "binary" or "overridable/grouped" scopes. The developer could specify an id to the scopes and when another scope of the same id is applied, the former scope is overriden by the new scope.

Help

This topic is locked













