A split from https://github.com/thoughtbot/administrate/pull/1494, removing the bits that were resolved at https://github.com/thoughtbot/administrate/pull/1557. Original description follows, with appropriate edits.
Working with Pundit, I was seeing this index page:
That was supposed to be 4 records, but they were showing as empty rows. Instead I was expecting to see the following:
The issue was that the Pundit scope for the model was returning those records, but the per-resource policy was returning false
for show?
on each one of them.
This is a bit of an edge case: if the user can't see the resources, surely the scope shouldn't be returning them. Still I can think of a use case where some users can see them listed (with limited information) but can't access the show page (with additional information). In any case, Pundit allows for this, and I think this behaviour is a bug.
The fix itself is just in app/views/administrate/application/_collection.html.erb
. The rest of the PR is me figuring out a way to test this in a disposable way that doesn't affect other specs.