#31: small refactoring of #autostart_iso_builds method

This commit is contained in:
Vokhmin Alexey V 2013-03-22 23:14:06 +04:00
parent 72950e299c
commit 296627557e
1 changed files with 2 additions and 3 deletions

View File

@ -62,15 +62,14 @@ class Product < ActiveRecord::Base
def self.autostart_iso_builds(autostart_status)
Product.where(:autostart_status => autostart_status).each do |product|
pbl = product.product_build_lists.new(
:base_url => "http://#{product.platform.default_host}"
)
pbl = product.product_build_lists.new
[:params, :main_script, :project].each do |k|
pbl.send "#{k}=", product.send(k)
end
owner = product.platform.owner
pbl.user = owner.is_a?(User) ? owner : owner.owner
pbl.autostarted = true
pbl.base_url = "http://#{product.platform.default_host}"
pbl.time_living = product.time_living / 60
pbl.project_version = product.project.default_branch
pbl.save