Skip to content

Commit af7d761

Browse files
grkseuros
authored andcommitted
Call Module#module_parent instead of deprecated #parent (#354)
1 parent 24fcd37 commit af7d761

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/closure_tree/support.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def initialize(model_class, options)
3232
end
3333

3434
def hierarchy_class_for_model
35-
hierarchy_class = model_class.parent.const_set(short_hierarchy_class_name, Class.new(ActiveRecord::Base))
35+
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))
3637
use_attr_accessible = use_attr_accessible?
3738
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
3839
model_class_name = model_class.to_s

0 commit comments

Comments
 (0)