We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1bc10c8 commit 27a2992Copy full SHA for 27a2992
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
hierarchy_class.class_eval <<-RUBY, __FILE__, __LINE__ + 1
0 commit comments