Commit 6dadde7c by liyijie

policy_association_chain only policy association_chain

parent a286390a
......@@ -201,7 +201,9 @@ class SimpleController::BaseController < ::InheritedResources::Base
def policy_association_chain
policy_class ||= self.class.instance_variable_get(:@policy_class)
if policy_class.present? && scope_policy_class = "#{policy_class}::Scope".safe_constantize
if policy_class.present? &&
scope_policy_class = "#{policy_class}::Scope".safe_constantize &&
origin_end_of_association_chain.is_a?(ActiveRecord::AssociationRelation)
scope_policy_class.new(current_user, origin_end_of_association_chain).resolve
else
origin_end_of_association_chain
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment