Commit 67f01625 by liyijie

end_of_association_chain support with policy_class scope

parent 105ab79f
...@@ -170,7 +170,12 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -170,7 +170,12 @@ class SimpleController::BaseController < ::InheritedResources::Base
end end
def end_of_association_chain def end_of_association_chain
after_association_chain(super) policy_class ||= self.class.instance_variable_get(:@policy_class)
if policy_class.present? && scope_policy_class = "#{policy_class}::Scope".safe_constantize
after_association_chain(scope_policy_class.new(current_user, super).resolve)
else
after_association_chain(super)
end
end end
def collection def collection
......
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