deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [11/12] git commit: Core: Fixed JSON and XML serialization of realms
Date Fri, 22 Feb 2013 10:32:24 GMT
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 <mfojtik@redhat.com>
Authored: Mon Feb 11 12:26:48 2013 +0100
Committer: Michal fojtik <mfojtik@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


Mime
View raw message