Skip to content

Commit

Permalink
Call Module#module_parent instead of deprecated #parent (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
grk authored and seuros committed Jan 13, 2020
1 parent 24fcd37 commit af7d761
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/closure_tree/support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit af7d761

Please sign in to comment.