From f49ebbd1db8993c93866faabdf704d3488f569ce Mon Sep 17 00:00:00 2001 From: Grzesiek Kolodziejczyk Date: Tue, 22 Oct 2019 13:55:40 +0200 Subject: [PATCH] Call Module#module_parent instead of deprecated #parent --- lib/closure_tree/support.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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