Merge pull request #295 from abf/rosa-build:fix-platform-arch-settings

Fix: platform-arch-settings
This commit is contained in:
avm 2013-09-02 18:46:24 +04:00
commit 7196b2e201
1 changed files with 7 additions and 2 deletions

View File

@ -11,8 +11,13 @@ module PlatformsHelper
end end
def platform_arch_settings(platform) def platform_arch_settings(platform)
settings = platform.platform_arch_settings settings = platform.platform_arch_settings
settings |= Arch.where('id not in (?)', settings.map(&:arch_id)).map do |arch| arches = if arch_ids = settings.map(&:arch_id) && arch_ids.present?
Arch.where('id not in (?)', arch_ids)
else
Arch.all
end
settings |= arches.map do |arch|
platform.platform_arch_settings.build( platform.platform_arch_settings.build(
:arch_id => arch.id, :arch_id => arch.id,
:time_living => PlatformArchSetting::DEFAULT_TIME_LIVING :time_living => PlatformArchSetting::DEFAULT_TIME_LIVING