#881: change default value of param "use_save_to_repository"

This commit is contained in:
Vokhmin Alexey V 2013-02-04 13:09:43 +04:00
parent db7a6f892f
commit 4f4090b063
5 changed files with 9 additions and 11 deletions

View File

@ -26,10 +26,10 @@ class BuildList < ActiveRecord::Base
validates :update_type, :inclusion => {:in => RELEASE_UPDATE_TYPES, :message => I18n.t('flash.build_list.frozen_platform')}, validates :update_type, :inclusion => {:in => RELEASE_UPDATE_TYPES, :message => I18n.t('flash.build_list.frozen_platform')},
:if => Proc.new { |b| b.advisory.present? } :if => Proc.new { |b| b.advisory.present? }
validate lambda { validate lambda {
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.main? && save_to_platform_id != build_for_platform_id
} }
validate lambda { validate lambda {
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_build_for_platform')) unless build_for_platform.platform_type == 'main' errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_build_for_platform')) unless build_for_platform.main?
} }
validate lambda { validate lambda {
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.map(&:id) errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.map(&:id)
@ -42,11 +42,11 @@ class BuildList < ActiveRecord::Base
validate lambda { validate lambda {
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_project')) unless save_to_repository.projects.exists?(project_id) errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_project')) unless save_to_repository.projects.exists?(project_id)
} }
validate lambda {
if save_to_platform.main? && use_save_to_repository before_create do |build_list|
errors.add(:use_save_to_repository, I18n.t('flash.build_list.wrong_disable_repository')) build_list.use_save_to_repository = false if save_to_platform.main?
end nil
} end
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash, attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
:arch_id, :project_id, :save_to_repository_id, :update_type, :arch_id, :project_id, :save_to_repository_id, :update_type,

View File

@ -144,7 +144,6 @@ en:
flash: flash:
build_list: build_list:
wrong_disable_repository: Repository to save package may be disabled only for personal platform.
saved: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' has been created successfully saved: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' has been created successfully
save_error: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' could not been created save_error: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' could not been created
no_project_version_selected: Select any version of the project no_project_version_selected: Select any version of the project

View File

@ -143,7 +143,6 @@ ru:
flash: flash:
build_list: build_list:
wrong_disable_repository: Репозиторий для сохранения может быть отключен только для персональной платформы.
saved: Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно saved: Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}'
no_project_version_selected: Выберите какую-нибудь версию no_project_version_selected: Выберите какую-нибудь версию

View File

@ -1,5 +1,5 @@
class AddUsePersonalRepositoryToBuildList < ActiveRecord::Migration class AddUsePersonalRepositoryToBuildList < ActiveRecord::Migration
def change def change
add_column :build_lists, :use_save_to_repository, :boolean, :default => false add_column :build_lists, :use_save_to_repository, :boolean, :default => true
end end
end end

View File

@ -133,7 +133,7 @@ ActiveRecord::Schema.define(:version => 20130201094007) do
t.boolean "new_core", :default => true t.boolean "new_core", :default => true
t.string "last_published_commit_hash" t.string "last_published_commit_hash"
t.integer "container_status" t.integer "container_status"
t.boolean "use_save_to_repository", :default => false t.boolean "use_save_to_repository", :default => true
end end
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id" add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"