Skip to content

Scoped index resource

koenhandekyn edited this page Mar 5, 2012 · 2 revisions

To scope the collection returned in the index action, follow this pattern:

controller do
  def scoped_collection
    end_of_association_chain.scoped_by_something
  end
end

for a CanCan example see Enforce CanCan constraints

Clone this wiki locally