#31: rename 'autostart' field to 'autostart_status' in Product model

This commit is contained in:
Vokhmin Alexey V 2013-03-22 20:15:37 +04:00
parent 3865332e8a
commit a5e122dc63
6 changed files with 19 additions and 14 deletions

View File

@ -20,7 +20,8 @@ class Product < ActiveRecord::Base
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
validates :project_id, :presence => true
validates :main_script, :params, :length => { :maximum => 255 }
validates :autostart, :numericality => true, :inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true
validates :autostart_status, :numericality => true,
:inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true
scope :recent, order("#{table_name}.name ASC")
@ -30,7 +31,7 @@ class Product < ActiveRecord::Base
:main_script,
:params,
:platform_id,
:autostart
:autostart_status
attr_readonly :platform_id
def full_clone(attrs = {})
@ -43,12 +44,16 @@ class Product < ActiveRecord::Base
end
end
def human_status
self.class.human_status(status)
def human_autostart_status
self.class.human_autostart_status(autostart_status)
end
def self.human_status(status)
I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[status]}")
def self.human_autostart_status(autostart_status)
I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}")
end
# def self.autostart_iso_builds(autostart_status)
# Product.where(:autostart_status => autostart_status)
# end
end

View File

@ -12,8 +12,8 @@
= render 'def_fields', :f => f
.leftlist= f.label :autostart
.rightlist= f.select :autostart, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_status(status), status]}, {:include_blank => true, :selected => @product.autostart}
.leftlist= f.label :autostart_status
.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {:include_blank => true, :selected => @product.autostart_status}
.both
.button_block

View File

@ -29,7 +29,7 @@ en:
product: Product
attributes:
product:
autostart: Autostart
autostart_status: Autostart
name: Name
description: Description
platform_id: Platform

View File

@ -29,7 +29,7 @@ ru:
product: Продукт
attributes:
product:
autostart: Автостарт
autostart_status: Автостарт
name: Название
description: Описание
platform_id: Платформа

View File

@ -1,6 +1,6 @@
class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration
def change
add_column :products, :autostart, :integer, :default => nil
add_column :products, :autostart_status, :integer, :default => nil
add_column :product_build_lists, :not_delete, :boolean, :default => false
add_column :product_build_lists, :autostarted, :boolean, :default => false
end

View File

@ -330,7 +330,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do
t.string "params"
t.string "main_script"
t.integer "time_living"
t.integer "autostart"
t.integer "autostart_status"
end
create_table "project_imports", :force => true do |t|