From fa0d970d31ec2b8eb82a62e4d4aceb6a640f92ea Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Mon, 19 May 2008 13:55:55 -0700 Subject: [PATCH] fixed mime types for latest couchdb revision --- lib/database.rb | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lib/database.rb b/lib/database.rb index 6d72265..e71cdab 100644 --- a/lib/database.rb +++ b/lib/database.rb @@ -13,16 +13,13 @@ class CouchRest CouchRest.get "#{@root}/_all_docs" end - def temp_view map, reduce = nil - if reduce - funcs = { - :map => map, - :reduce => reduce - } - else - funcs = map - end - JSON.parse(RestClient.post("#{@root}/_temp_view", JSON.unparse(funcs), {"Content-Type" => "text/javascript"})) + def temp_view map, reduce = nil, type = 'application/json' + funcs = { + :map => map, + :type => type + } + funcs[:reduce] = reduce if reduce + JSON.parse(RestClient.post("#{@root}/_temp_view", JSON.unparse(funcs), {"Content-Type" => type})) end def view name