Skip to content

Commit f3b33f8

Browse files
fix: hierarchy model with namespace should inherit from the superclass of basic model (#384)
Co-authored-by: xiaoyu <[email protected]>
1 parent aca46bf commit f3b33f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/closure_tree/support.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def initialize(model_class, options)
3333

3434
def hierarchy_class_for_model
3535
parent_class = ActiveSupport::VERSION::MAJOR >= 6 ? model_class.module_parent : model_class.parent
36-
hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base))
36+
hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(model_class.superclass))
3737
use_attr_accessible = use_attr_accessible?
3838
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
3939
model_class_name = model_class.to_s

0 commit comments

Comments
 (0)