lib/closure_tree/support.rb in closure_tree-7.3.0 vs lib/closure_tree/support.rb in closure_tree-7.4.0.rc1
- old
+ new
@@ -31,10 +31,10 @@
end
end
def hierarchy_class_for_model
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))
+ hierarchy_class = parent_class.const_set(short_hierarchy_class_name, Class.new(model_class.superclass))
use_attr_accessible = use_attr_accessible?
include_forbidden_attributes_protection = include_forbidden_attributes_protection?
model_class_name = model_class.to_s
hierarchy_class.class_eval do
include ActiveModel::ForbiddenAttributesProtection if include_forbidden_attributes_protection