Blog25.8K views2,698 votes0 replies1,898 following
Rails Scopes: Keep Query Constraints Atomic and Verifiable
Scopes work best as small, reusable constraints. Keep final query assembly at the call site, and verify the generated SQL with to_sql before trusting a long chain.