From: Michal Fojtik <[email protected]>

* In JSON the field is called 'properties', but in XML the XmlSimple parser
  call it 'property'. This patch will learn the store_attributes_for method
  how to deal with this.

Signed-off-by: Michal fojtik <[email protected]>
---
 server/lib/cimi/helpers/database_helper.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/cimi/helpers/database_helper.rb 
b/server/lib/cimi/helpers/database_helper.rb
index 090f6d8..b581c7b 100644
--- a/server/lib/cimi/helpers/database_helper.rb
+++ b/server/lib/cimi/helpers/database_helper.rb
@@ -44,7 +44,11 @@ module Deltacloud
 
         entity.description = extract_attribute_value('description', attrs) if 
attrs.has_key? 'description'
         entity.name = extract_attribute_value('name', attrs) if attrs.has_key? 
'name'
-        entity.ent_properties = extract_attribute_value('properties', 
attrs).to_json if attrs.has_key? 'properties'
+        if attrs.has_key? 'properties'
+          entity.ent_properties = extract_attribute_value('properties', 
attrs).to_json
+        elsif attrs.has_key? 'property'
+          entity.ent_properties = extract_attribute_value('property', 
attrs).to_json
+        end
 
         entity.save! && entity
       end
-- 
1.8.0.2

Reply via email to