elabs/pundit — pull request #88 by equivalent (2014-01-06 10:29:16+00:00)
Title: update #authorize to be able to pass additional arguments to policy methods

I have a closed system where user shouldn't see nested controller#index when he cannot access the parent controller #show

so something like: `cats/123/catched_mouses`

so there is two way to do it

```
class CathedMousesController < ApplicationControllerd
def index
@mouses = @cat.mouses.
authorize(@cat)
authorize(@mouses)
end
end
```

but I think this should be policy job, so another way:

```
class CathedMousesController < ApplicationControllerd
def index
@cat.mouses.
authorize(@mouses, index?: @cat)
end
end

class CatchedMousePolicy

def index?(related_cat)
CatPolicy.new(user, related_cat).show?
end
end
```

yes technically I can just allow the index and list no `catched_mouses` but I don't want allow user to be able to load mice#index if he cannot see the cat

so this pull request is allowing you to pass additional argument to permission check