You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started using administrate and encountered a problem when integrating with Pundit.
When I include Administrate::Punditize in the Admin::ApplicationController, I get a Pundit::NotAuthorizedError at my /admin route, with error: not allowed to index? this Class.
The action I'm rooting to is:
namespace :admin do
resources :venues
resources :users
root to: "venues#index"
end
The Venues controller has:
def index
@venues = policy_scope(Venue)
end
And the policy has:
class VenuePolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.visible_to(user)
end
end
visible_to is an included module scope:
class_methods do
def visible_to(user)
user&.admin? ? all : published
end
end
The policy works outside of administrate, so I'm not sure what I'm doing wrong here. Any ideas?
The text was updated successfully, but these errors were encountered:
I just started using administrate and encountered a problem when integrating with Pundit.
When I
include Administrate::Punditize
in the Admin::ApplicationController, I get a Pundit::NotAuthorizedError at my /admin route, with error:not allowed to index? this Class
.The action I'm rooting to is:
The Venues controller has:
And the policy has:
visible_to is an included module scope:
The policy works outside of administrate, so I'm not sure what I'm doing wrong here. Any ideas?
The text was updated successfully, but these errors were encountered: