elabs/pundit — pull request #176 by Unknown-Guy (2014-07-17 09:13:26+00:00)
Title: Allow overriding namespace

Guessing namespace from controller is not always enough. This adds ability to set it in controller or pass in in helpers
So for example to check if user have access to ```Admin::ArticlesController#new``` from ```ArticlesController#index``` one can call ```policy(Article, Admin).new?``` or for editing ```policy(article, Admin).edit?```
Similarly in another direction ```policy(article, false).edit?```

This also fixes situation when there is multiple namespaces so calling ```authorize(@user)``` in ```MyEngine::Admin::UsersController``` will look for policy ```MyEngine::Admin::UserPolicy```

This also allows setting namespace manually in controller. To set namespace in ```RegisteredUsersController``` to another just redefining ```policy_namespace``` in controller is enough.
````
private

def policy_namespace
Member
end
````
So ```authorize```, ```policy``` etc. will check ```Member::UserPolicy```

Putting this up to discussion. Some cleanup still needed. But overall this works nicely in our rails engine without any custom pundit hacks.