Skip to content

Commit

Permalink
fix: hierarchy model with namespace should inherit from the superclas…
Browse files Browse the repository at this point in the history
…s of basic model (#384)

Co-authored-by: xiaoyu <shawn.zhu@chowbus.com>
  • Loading branch information
shawndodo and shawn-zhuxy authored Sep 17, 2021
1 parent aca46bf commit f3b33f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/closure_tree/support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def initialize(model_class, options)

def hierarchy_class_for_model
parent_class = ActiveSupport::VERSION::MAJOR >= 6 ? model_class.module_parent : model_class.parent
hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base))
hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(model_class.superclass))
use_attr_accessible = use_attr_accessible?
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
model_class_name = model_class.to_s
Expand Down

0 comments on commit f3b33f8

Please sign in to comment.