class ActiveAdmin::PunditAdapter
def compat_policy(subject)
This fallback might be removed in future versions of ActiveAdmin, so
detection, so people are probably relying on it.
the only thing that worked in this case before we fixed our buggy namespace
we should try to search it without namespace. This is because that's
I.e.: when class name contains `default_policy_namespace` (eg: ShopAdmin)
This method is needed to fallback to our previous policy searching logic.
def compat_policy(subject) return unless default_policy_namespace target = policy_target(subject) return unless target.class.to_s.include?(default_policy_module) && (policy = policy(target)) policy_name = policy.class.to_s ActiveAdmin.deprecator.warn "You have `pundit_policy_namespace` configured as `#{default_policy_namespace}`, " \ "but ActiveAdmin was unable to find policy #{default_policy_module}::#{policy_name}. " \ "#{policy_name} will be used instead. " \ "This behavior will be removed in future versions of ActiveAdmin. " \ "To fix this warning, move your #{policy_name} policy to the #{default_policy_module} namespace" policy end