#31: rename 'autostart' field to 'autostart_status' in Product model
This commit is contained in:
parent
3865332e8a
commit
a5e122dc63
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,7 +29,7 @@ en:
|
|||
product: Product
|
||||
attributes:
|
||||
product:
|
||||
autostart: Autostart
|
||||
autostart_status: Autostart
|
||||
name: Name
|
||||
description: Description
|
||||
platform_id: Platform
|
||||
|
|
|
@ -29,7 +29,7 @@ ru:
|
|||
product: Продукт
|
||||
attributes:
|
||||
product:
|
||||
autostart: Автостарт
|
||||
autostart_status: Автостарт
|
||||
name: Название
|
||||
description: Описание
|
||||
platform_id: Платформа
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -321,8 +321,8 @@ ActiveRecord::Schema.define(:version => 20130322132919) do
|
|||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
||||
create_table "products", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
t.string "name", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.text "description"
|
||||
|
@ -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|
|
||||
|
|
Loading…
Reference in New Issue