From: David Lutterkort <[email protected]>

---
 server/lib/cimi/models/collection.rb |    1 -
 server/lib/cimi/models/schema.rb     |    4 ++--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/server/lib/cimi/models/collection.rb 
b/server/lib/cimi/models/collection.rb
index 2373359..b099669 100644
--- a/server/lib/cimi/models/collection.rb
+++ b/server/lib/cimi/models/collection.rb
@@ -38,7 +38,6 @@ module CIMI::Model
     # Prepare to serialize
     def prepare
       self.count = self.entries.size
-      self.count = nil if self.count == 0
       if self.class.embedded
         ["id", "href"].each { |a| self[a] = nil if self[a] == "" }
         # Handle href and id, which are really just aliases of one another
diff --git a/server/lib/cimi/models/schema.rb b/server/lib/cimi/models/schema.rb
index e9504e9..fe4ed07 100644
--- a/server/lib/cimi/models/schema.rb
+++ b/server/lib/cimi/models/schema.rb
@@ -235,7 +235,7 @@ class CIMI::Model::Schema
 
     def to_xml(model, xml)
       model[name].prepare
-      if model[name].count.nil?
+      if model[name].entries.empty?
         xml[xml_name] = { "href" => model[name].href }
       else
         xml[xml_name] = @collection_class.schema.to_xml(model[name])
@@ -244,7 +244,7 @@ class CIMI::Model::Schema
 
     def to_json(model, json)
       model[name].prepare
-      if model[name].count.nil?
+      if model[name].entries.empty?
         json[json_name] = { "href" => model[name].href }
       else
         json[json_name] = @collection_class.schema.to_json(model[name])
-- 
1.7.7.6

Reply via email to