Commit e26e923e by liyijie

feat: add default policy_class by safe_constantize

parent 85af9c63
...@@ -113,7 +113,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -113,7 +113,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
@ransack_off = options.delete(:ransack_off) @ransack_off = options.delete(:ransack_off)
@paginate_off = options.delete(:paginate_off) @paginate_off = options.delete(:paginate_off)
@distinct_off = options.delete(:distinct_off) @distinct_off = options.delete(:distinct_off)
@policy_class = options.delete(:policy_class) @policy_class = options.delete(:policy_class) || self.class.name.sub(/Controller$/, 'Policy').safe_constantize
self.class_attribute :importable_class, instance_writer: false unless self.respond_to? :importable_class self.class_attribute :importable_class, instance_writer: false unless self.respond_to? :importable_class
self.class_attribute :exportable_class, instance_writer: false unless self.respond_to? :exportable_class self.class_attribute :exportable_class, instance_writer: false unless self.respond_to? :exportable_class
......
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