Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-06 00:10:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-06 00:10:12 +0300
commit6d8bbacd130c091fbb9ab53d4be5688a620982fc (patch)
tree0d921f1f55733d16c1f496c16701c5067849ee0d /config
parenta150bd5bac8535d5a38e0a8c60c30e45b1582413 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'config')
-rw-r--r--config/initializers/00_rails_disable_joins.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/config/initializers/00_rails_disable_joins.rb b/config/initializers/00_rails_disable_joins.rb
new file mode 100644
index 00000000000..4274365ccad
--- /dev/null
+++ b/config/initializers/00_rails_disable_joins.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+# Backported from Rails 7.0
+# Initial support for has_many :through was implemented in https://github.com/rails/rails/pull/41937
+# Support for has_one :through was implemented in https://github.com/rails/rails/pull/42079
+raise 'DisableJoins patch is only to be used with versions of Rails < 7.0' unless Rails::VERSION::MAJOR < 7
+
+ActiveRecord::Associations::Association.prepend(GemExtensions::ActiveRecord::Association)
+# Temporarily allow :disable_joins to accept a lambda argument, to control rollout with feature flags
+ActiveRecord::Associations::Association.prepend(GemExtensions::ActiveRecord::ConfigurableDisableJoins)
+ActiveRecord::Associations::Builder::HasOne.prepend(GemExtensions::ActiveRecord::Associations::Builder::HasOne)
+ActiveRecord::Associations::Builder::HasMany.prepend(GemExtensions::ActiveRecord::Associations::Builder::HasMany)
+ActiveRecord::Associations::HasOneThroughAssociation.prepend(GemExtensions::ActiveRecord::Associations::HasOneThroughAssociation)
+ActiveRecord::Associations::HasManyThroughAssociation.prepend(GemExtensions::ActiveRecord::Associations::HasManyThroughAssociation)
+ActiveRecord::Associations::Preloader::ThroughAssociation.prepend(GemExtensions::ActiveRecord::Associations::Preloader::ThroughAssociation)
+ActiveRecord::Base.extend(GemExtensions::ActiveRecord::DelegateCache)