deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [3/5] git commit: CIMI: Fixed error when collection used as value for $select (DTACLOUD-432)
Date Tue, 29 Jan 2013 13:40:43 GMT
CIMI: Fixed error when collection used as value for $select (DTACLOUD-432)


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/c9b25edf
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/c9b25edf
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/c9b25edf

Branch: refs/heads/master
Commit: c9b25edfdcccc7e137e5940e97d1fced557aaaa1
Parents: 39cf10f
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Wed Jan 23 16:40:26 2013 +0100
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Jan 29 14:38:53 2013 +0100

----------------------------------------------------------------------
 server/lib/cimi/models/collection.rb |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/c9b25edf/server/lib/cimi/models/collection.rb
----------------------------------------------------------------------
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
 


Mime
View raw message