From: Jan Provaznik <[email protected]>

we need this if we want to display template type on 5130 page (show templates)
---
 src/app/models/template.rb                        |    7 ++++++-
 src/db/migrate/20100830150014_create_templates.rb |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/src/app/models/template.rb b/src/app/models/template.rb
index 6469b04..239de4d 100644
--- a/src/app/models/template.rb
+++ b/src/app/models/template.rb
@@ -8,8 +8,12 @@ class Template < ActiveRecord::Base
   WAREHOUSE_CONFIG = YAML.load_file("#{RAILS_ROOT}/config/image_warehouse.yml")
 
   validates_presence_of :uuid
-  #validates_presence_of :name
   validates_uniqueness_of :uuid
+  # uncomment this after reworking view (currently is used wizard,
+  # so there can be situation when save is called and name and platform can be
+  # unset)
+  #validates_presence_of :name
+  #validates_presence_of :platform
 
   def update_xml_attributes!(opts = {})
     doc = xml
@@ -47,6 +51,7 @@ class Template < ActiveRecord::Base
     self.uuid ||= "#{xml.name}-#{Time.now.to_f.to_s}"
     self.name = xml.name
     self.summary = xml.description
+    self.platform = xml.platform
   end
 
   def providers
diff --git a/src/db/migrate/20100830150014_create_templates.rb 
b/src/db/migrate/20100830150014_create_templates.rb
index e3a2ac1..00b1966 100644
--- a/src/db/migrate/20100830150014_create_templates.rb
+++ b/src/db/migrate/20100830150014_create_templates.rb
@@ -5,6 +5,7 @@ class CreateTemplates < ActiveRecord::Migration
       t.binary  :xml, :null => false
       t.string  :uri
       t.string  :name
+      t.string  :platform
       t.text    :summary
       t.boolean :complete, :default => false
       t.timestamps
-- 
1.7.2.2

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to