diff --git a/gemfiles/activerecord_4.2.gemfile b/gemfiles/activerecord_4.2.gemfile index ba3a7fd9..8b9c2b75 100644 --- a/gemfiles/activerecord_4.2.gemfile +++ b/gemfiles/activerecord_4.2.gemfile @@ -7,7 +7,7 @@ gem "activerecord", "~> 4.2.0" platforms :ruby do gem "mysql2", "< 0.5" gem "pg", "~> 0.21" - gem "sqlite3" + gem "sqlite3", "~> 1.3", "< 1.4" end platforms :jruby do diff --git a/gemfiles/activerecord_5.0.gemfile b/gemfiles/activerecord_5.0.gemfile index 933e74d7..83adaeb4 100644 --- a/gemfiles/activerecord_5.0.gemfile +++ b/gemfiles/activerecord_5.0.gemfile @@ -7,7 +7,7 @@ gem "activerecord", "~> 5.0.0" platforms :ruby do gem "mysql2" gem "pg" - gem "sqlite3" + gem "sqlite3", "~> 1.3", "< 1.4" end platforms :jruby do diff --git a/lib/closure_tree/support.rb b/lib/closure_tree/support.rb index 24459db9..03e73001 100644 --- a/lib/closure_tree/support.rb +++ b/lib/closure_tree/support.rb @@ -32,7 +32,12 @@ 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 = if ActiveSupport.version >= Gem::Version.new('6.0.0.beta1') + model_class.module_parent + else + model_class.parent + end + 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