From 3daaab49245359d6a357d424f62c1f2a5ea25726 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Wed, 19 Dec 2018 09:57:38 +0100 Subject: [PATCH] Make it possible to preload repository architectures Remove the duplicated order statement, which breaks preloading. This order isn't used normally (as it's a :through relationship and repository_architectures have an order already), but it breaks in preload situation where rails will load all architectures in a 2nd statement. Fixes #6662 --- src/api/app/models/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/app/models/repository.rb b/src/api/app/models/repository.rb index 52ab548c1da..f19525431fb 100644 --- a/src/api/app/models/repository.rb +++ b/src/api/app/models/repository.rb @@ -16,7 +16,7 @@ class Repository < ApplicationRecord has_many :product_update_repositories, dependent: :delete_all has_many :product_medium, dependent: :delete_all has_many :repository_architectures, -> { order('position') }, dependent: :destroy, inverse_of: :repository - has_many :architectures, -> { order('position') }, through: :repository_architectures + has_many :architectures, through: :repository_architectures scope :not_remote, -> { where(remote_project_name: '') } scope :remote, -> { where.not(remote_project_name: '') }