{"action":"closed","issue":{"url":"https://api.github.com/repos/elabs/pundit/issues/382","repository_url":"https://api.github.com/repos/elabs/pundit","labels_url":"https://api.github.com/repos/elabs/pundit/issues/382/labels{/name}","comments_url":"https://api.github.com/repos/elabs/pundit/issues/382/comments","events_url":"https://api.github.com/repos/elabs/pundit/issues/382/events","html_url":"https://github.com/elabs/pundit/issues/382","id":149054705,"number":382,"title":"policy_scope for namespaced policy","user":{"login":"5t111111","id":333180,"avatar_url":"https://avatars.githubusercontent.com/u/333180?v=3","gravatar_id":"","url":"https://api.github.com/users/5t111111","html_url":"https://github.com/5t111111","followers_url":"https://api.github.com/users/5t111111/followers","following_url":"https://api.github.com/users/5t111111/following{/other_user}","gists_url":"https://api.github.com/users/5t111111/gists{/gist_id}","starred_url":"https://api.github.com/users/5t111111/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/5t111111/subscriptions","organizations_url":"https://api.github.com/users/5t111111/orgs","repos_url":"https://api.github.com/users/5t111111/repos","events_url":"https://api.github.com/users/5t111111/events{/privacy}","received_events_url":"https://api.github.com/users/5t111111/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-18T06:23:40Z","updated_at":"2016-04-21T18:32:08Z","closed_at":"2016-04-21T18:32:08Z","body":"Thanks to #331, I know that the namespaced policies are supported without creating physical models (e.g. `Admin::Post`), but I don't know how to do the same thing with `policy_scope`.\r\n\r\nFor the moment, I define a scope for namespaced policy lke the following:\r\n\r\n__Controller__\r\n\r\n````ruby\r\nclass PostsController < ApplicationController\r\n...\r\n  def index\r\n    @posts = policy_scope([:admin, Post])\r\n  end\r\n...\r\nend\r\n```\r\n\r\n__Policy__\r\n\r\n```ruby\r\nmodule Admin\r\n  class PostPolicy < ApplicationPolicy\r\n    class Scope < Scope\r\n      def resolve\r\n        scope[1].where(published: true)\r\n      end\r\n    end\r\n  end\r\nend\r\n```\r\n\r\nSince `scope` passed to `resolve` is just an `Array`, you have to pick a class object out of it. Are there any other ways to handle namespaced policies along with `policy_scope` ?"}}