We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 24fcd37 commit af7d761Copy full SHA for af7d761
lib/closure_tree/support.rb
@@ -32,7 +32,8 @@ def initialize(model_class, options)
32
end
33
34
def hierarchy_class_for_model
35
- 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
36
+ hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base))
37
use_attr_accessible = use_attr_accessible?
38
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
39
model_class_name = model_class.to_s
0 commit comments