You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2013/02/22 11:32:24 UTC

[11/12] git commit: Core: Fixed JSON and XML serialization of realms

Core: Fixed JSON and XML serialization of realms


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

Branch: refs/heads/master
Commit: 7a801a37da5e3b64eaa813d2c08f8dcacd258f8e
Parents: f0b6696
Author: Michal Fojtik <mf...@redhat.com>
Authored: Mon Feb 11 12:26:48 2013 +0100
Committer: Michal fojtik <mf...@redhat.com>
Committed: Fri Feb 22 11:32:02 2013 +0100

----------------------------------------------------------------------
 server/lib/deltacloud/models/realm.rb |    6 +++++-
 server/views/realms/show.xml.haml     |    3 +--
 2 files changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7a801a37/server/lib/deltacloud/models/realm.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/models/realm.rb b/server/lib/deltacloud/models/realm.rb
index ce1ac26..df69a58 100644
--- a/server/lib/deltacloud/models/realm.rb
+++ b/server/lib/deltacloud/models/realm.rb
@@ -27,6 +27,10 @@ class Realm < BaseModel
     self.resource_types ||= []
   end
 
+  def resource_types
+    @resource_types || []
+  end
+
   def to_hash(context)
     r = {
       :id => self.id,
@@ -35,7 +39,7 @@ class Realm < BaseModel
       :state => state,
       :limit => limit
     }
-    r.merge!({:resource_types => resource_types}) if resource_types
+    r[:resource_types] = resource_types || []
     r
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7a801a37/server/views/realms/show.xml.haml
----------------------------------------------------------------------
diff --git a/server/views/realms/show.xml.haml b/server/views/realms/show.xml.haml
index 268cb65..a6e2030 100644
--- a/server/views/realms/show.xml.haml
+++ b/server/views/realms/show.xml.haml
@@ -10,5 +10,4 @@
       =cdata do
         =@realm.limit
   - @realm.resource_types.each do |r|
-    %resource_type<
-      =r
+    %resource_type=r