deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 1/3] CIMI: Fixed error when collection used as value for $select (DTACLOUD-432)
Date Wed, 23 Jan 2013 15:51:55 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/cimi/models/collection.rb | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
index 0f2a89e..aafa6a5 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -24,11 +24,15 @@ module CIMI::Model
     self.schema
 
     def initialize(values = {})
-      if values[:entries]
-        values[self.class.entry_name] = values.delete(:entries)
+      if values.kind_of?(Hash) 
+        if values[:entries]
+          values[self.class.entry_name] = values.delete(:entries)
+        end
+        values[self.class.entry_name] ||= []
+        super(values)
+      else
+        super
       end
-      values[self.class.entry_name] ||= []
-      super(values)
     end
 
     def entries
@@ -53,12 +57,12 @@ module CIMI::Model
     end
 
     def [](a)
-      a = entry_name if a == :entries
+      a = self.class.entry_name if a == :entries
       super(a)
     end
 
     def []=(a, v)
-      a = entry_name if a == :entries
+      a = self.class.entry_name if a == :entries
       super(a, v)
     end
 
-- 
1.8.1


Mime
View raw message