deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 08/11] Core: Fixed JSON and XML serialization of realms
Date Mon, 11 Feb 2013 12:35:49 GMT
From: Michal Fojtik <mfojtik@redhat.com>


Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/lib/deltacloud/models/realm.rb | 2 +-
 server/views/realms/show.xml.haml     | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/lib/deltacloud/models/realm.rb b/server/lib/deltacloud/models/realm.rb
index 1c25ba2..7f1e2e9 100644
--- a/server/lib/deltacloud/models/realm.rb
+++ b/server/lib/deltacloud/models/realm.rb
@@ -30,7 +30,7 @@ class Realm < BaseModel
       :state => state,
       :limit => limit
     }
-    r.merge!({:resource_types => resource_types}) if resource_types
+    r.merge!({:resource_types => resource_types || []})
     r
   end
 
diff --git a/server/views/realms/show.xml.haml b/server/views/realms/show.xml.haml
index 268cb65..f584c43 100644
--- a/server/views/realms/show.xml.haml
+++ b/server/views/realms/show.xml.haml
@@ -9,6 +9,7 @@
     %limit<
       =cdata do
         =@realm.limit
-  - @realm.resource_types.each do |r|
-    %resource_type<
-      =r
+  - if @realm.resource_types
+    - @realm.resource_types.each do |r|
+      %resource_type<
+        =r
-- 
1.8.1.2


Mime
View raw message