From 0509c6a031e441bfac1e7b57a0b42e6ba7e1d3aa Mon Sep 17 00:00:00 2001 From: Nathan Esquenazi Date: Thu, 14 Apr 2011 13:21:29 -0700 Subject: [PATCH] Handle collection hash case by stripping hash for now --- lib/rabl/engine.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/rabl/engine.rb b/lib/rabl/engine.rb index ef01fbaa..aa86b1b1 100644 --- a/lib/rabl/engine.rb +++ b/lib/rabl/engine.rb @@ -56,7 +56,8 @@ def object(data) # Sets the object as a collection casted to a simple array # collection @users def collection(data) - object(data.to_a) + data = data.respond_to?(:each_pair) ? data.keys.first : data + self.object(data) end # Indicates an attribute or method should be included in the json output