add-on $15/mo gem "avo-scopes"

Scopes

Automatically segment data by team, department, or any custom criteria. Makes complex data organization feel simple.

Scopes screenshot

What it does

avo-scopes

Segment your data more easily with named views of a resource, something like "Active", "Mine", or "Archived", shown as a row of tabs across the top of any index view, so the cuts of the data people reach for most are one click away instead of a filter someone re-applies every time. Each scope is a small class under app/avo/scopes/ that points at a model scope or a query proc, and you register it on the resource with the scope method.

Scopes work on association index views too, not just the top-level resource, so a record's related table gets the same tabs. Mark one default: true to pre-apply it on load, gate a scope behind visible so only the right users see it, or call remove_scope_all to drop the unfiltered "All" tab entirely. Your agent writes the scope classes; the tabbed index UI is already built and stays wired up as your resources change.

What you get

  • A tabbed scope bar on any resource index, so the views your team reaches for sit one click away instead of behind a filter they re-apply every time
  • Scope classes generated with bin/rails generate avo:scope, so a new named view is one command and a few lines, not a UI feature to design
  • Easily point a scope at a model scope or an inline query proc, so you reuse query logic you already trust instead of duplicating it in the admin
  • Scopes on association index views too, so a record's related tables get the same one-click views, not just top-level resources
  • Mark a scope default: true to land people on the right view on load, so the first thing they see is the data they actually came for
  • visible procs and remove_scope_all to control who sees which tabs, so each role gets the cuts that matter to them and nothing that doesn't

Why it pays off

  • Ship named index views this afternoon instead of generating a tabbed scope UI and the query wiring behind it.
  • Every Avo release makes it better: the scope tabs across the index keep working through upgrades, and fixes reach your app with bundle update.
  • When something breaks it's our code in our domain: we fix it once and ship the fix to every app, in this one and the next.

Questions

What's the difference between a scope and a filter?

A scope is a view you define once in code, like Active or Archived, that your team opens with one click from the tabs above the Index view. A filter is something a person sets each time to narrow a list. Use scopes for the cuts people reach for every day, and Dynamic Filters when they need to build their own query.

Can a scope be the view people land on?

Yes. Register it with default: true and the Index view opens on it. default also takes a proc, so each user can land on a different one, and remove_scope_all drops the unfiltered All tab.

ready to ship?

You ship it this afternoon. We keep it solid for years.