Commit d39093c3 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Fix autoloading of DisableJoins constants

These are prepended onto ActiveRecord classes which are not autoloaded.
This means autoloading does not work well inside these classes because
some references could be stale when autoloaded classes are unloaded.
parent 19f76cb5
......@@ -15,7 +15,7 @@ module GemExtensions
def scope
if disable_joins
DisableJoins::Associations::AssociationScope.create.scope(self)
::GemExtensions::ActiveRecord::DisableJoins::Associations::AssociationScope.create.scope(self)
else
super
end
......@@ -25,7 +25,7 @@ module GemExtensions
if klass
@association_scope ||= begin # rubocop:disable Gitlab/ModuleWithInstanceVariables
if disable_joins
DisableJoins::Associations::AssociationScope.scope(self)
::GemExtensions::ActiveRecord::DisableJoins::Associations::AssociationScope.scope(self)
else
super
end
......
......@@ -64,7 +64,7 @@ module GemExtensions
end
if scope.order_values.empty? && ordered
split_scope = DisableJoins::Relation.create(scope.klass, key, join_ids)
split_scope = ::GemExtensions::ActiveRecord::DisableJoins::Relation.create(scope.klass, key, join_ids)
split_scope.where_clause += scope.where_clause
split_scope
else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment