summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-05-31 11:12:21 -0500
committerDouwe Maan <douwe@selenight.nl>2017-05-31 11:12:26 -0500
commit257f4eaa97d4ebed7feac36040a37650c25a6ca0 (patch)
treeb3741561e3e0400802c5f59d01efee435fbe98a7
parente53169c9702f1f4f25f8f1e91ed9ab7ace0a3d41 (diff)
downloadgitlab-ce-257f4eaa97d4ebed7feac36040a37650c25a6ca0.tar.gz
Do not try to preload Commits when using Note.includes(:noteable)
-rw-r--r--config/initializers/active_record_locking.rb (renamed from config/initializers/ar_monkey_patch.rb)0
-rw-r--r--config/initializers/active_record_preloader.rb15
2 files changed, 15 insertions, 0 deletions
diff --git a/config/initializers/ar_monkey_patch.rb b/config/initializers/active_record_locking.rb
index 9266ff0f615..9266ff0f615 100644
--- a/config/initializers/ar_monkey_patch.rb
+++ b/config/initializers/active_record_locking.rb
diff --git a/config/initializers/active_record_preloader.rb b/config/initializers/active_record_preloader.rb
new file mode 100644
index 00000000000..3b16014f302
--- /dev/null
+++ b/config/initializers/active_record_preloader.rb
@@ -0,0 +1,15 @@
+module ActiveRecord
+ module Associations
+ class Preloader
+ module NoCommitPreloader
+ def preloader_for(reflection, owners, rhs_klass)
+ return NullPreloader if rhs_klass == ::Commit
+
+ super
+ end
+ end
+
+ prepend NoCommitPreloader
+ end
+ end
+end