Commit 1bdcad90 by liyijie

fix: 解决super导入时候,需要把自定义的options删除

parent 9e13a191
...@@ -114,6 +114,8 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -114,6 +114,8 @@ class SimpleController::BaseController < ::InheritedResources::Base
@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) || self.name.sub(/Controller$/, 'Policy').safe_constantize @policy_class = options.delete(:policy_class) || self.name.sub(/Controller$/, 'Policy').safe_constantize
_importable_class = options.delete(:importable_class)
_exportable_class = options.delete(:exportable_class)
set_view_path view_path if view_path.present? set_view_path view_path if view_path.present?
super(options) super(options)
...@@ -121,7 +123,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -121,7 +123,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
unless self.method_defined? :importable_class unless self.method_defined? :importable_class
self.class_attribute :importable_class, instance_writer: false self.class_attribute :importable_class, instance_writer: false
self.importable_class = self.importable_class =
options.delete(:importable_class) || _importable_class ||
(self.name.sub(/Controller$/, 'Excel::Import').safe_constantize && self.name.sub(/Controller$/, 'Excel').safe_constantize) || (self.name.sub(/Controller$/, 'Excel::Import').safe_constantize && self.name.sub(/Controller$/, 'Excel').safe_constantize) ||
self.resource_class self.resource_class
end end
...@@ -130,7 +132,7 @@ class SimpleController::BaseController < ::InheritedResources::Base ...@@ -130,7 +132,7 @@ class SimpleController::BaseController < ::InheritedResources::Base
self.class_attribute :exportable_class, instance_writer: false self.class_attribute :exportable_class, instance_writer: false
self.exportable_class = self.exportable_class =
options.delete(:exportable_class) || _exportable_class ||
(self.name.sub(/Controller$/, 'Excel::Export').safe_constantize && self.name.sub(/Controller$/, 'Excel').safe_constantize) || (self.name.sub(/Controller$/, 'Excel::Export').safe_constantize && self.name.sub(/Controller$/, 'Excel').safe_constantize) ||
self.resource_class self.resource_class
end end
......
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