From 60ce85269ed040a5dff572be1a6b8c9ba786d21e Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 11 Dec 2012 20:35:36 +0600 Subject: [PATCH] [refs #762] optimize build_for method --- app/models/project.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/project.rb b/app/models/project.rb index 64ffbe309..7fb0a55ac 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -124,14 +124,13 @@ class Project < ActiveRecord::Base #path #share by NFS end - def build_for(platform, repository_id, user, arch = 'i586', auto_publish = false, mass_build_id = nil, priority = 0) + def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0) # Select main and project platform repository(contrib, non-free and etc) # If main does not exist, will connect only project platform repository # If project platform repository is main, only main will be connect main_rep_id = platform.repositories.find_by_name('main').try(:id) build_reps_ids = [main_rep_id, repository_id].compact.uniq - arch = Arch.find_by_name(arch) if arch.acts_like?(:string) build_lists.create do |bl| bl.save_to_platform = platform bl.build_for_platform = platform