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