diff --git a/lib/closure_tree/support.rb b/lib/closure_tree/support.rb index 24459db9..9dd7604c 100644 --- a/lib/closure_tree/support.rb +++ b/lib/closure_tree/support.rb @@ -32,7 +32,8 @@ def initialize(model_class, options) end def hierarchy_class_for_model - hierarchy_class = model_class.parent.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base)) + 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)) use_attr_accessible = use_attr_accessible? include_forbidden_attributes_protection = include_forbidden_attributes_protection? model_class_name = model_class.to_s