Commit 5c3341c5 by liyijie

scope_policy_class use in policy_association_chain

parent c86bbf36
......@@ -201,9 +201,8 @@ class SimpleController::BaseController < ::InheritedResources::Base
def policy_association_chain
policy_class ||= self.class.instance_variable_get(:@policy_class)
scope_policy_class = "#{policy_class}::Scope".safe_constantize
if policy_class.present? &&
scope_policy_class &&
(scope_policy_class = "#{policy_class}::Scope".safe_constantize) &&
origin_end_of_association_chain.is_a?(ActiveRecord::Relation)
scope_policy_class.new(current_user, origin_end_of_association_chain).resolve
else
......
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