From b3a6a081fdab2a48ba362e6b0da77ad8673ba8a8 Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Mon, 9 Mar 2009 13:12:28 -0700 Subject: [PATCH] fix for design doc url changes --- lib/couchrest/core/database.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/couchrest/core/database.rb b/lib/couchrest/core/database.rb index 067e885..f7bbfcc 100644 --- a/lib/couchrest/core/database.rb +++ b/lib/couchrest/core/database.rb @@ -61,12 +61,15 @@ module CouchRest # paramaters as described in http://wiki.apache.org/couchdb/HttpViewApi def view(name, params = {}, &block) keys = params.delete(:keys) - url = CouchRest.paramify_url "#{@uri}/_view/#{name}", params + name = name.split('/') # I think this will always be length == 2, but maybe not... + dname = name.shift + vname = name.join('/') + url = CouchRest.paramify_url "#{@uri}/_design/#{dname}/_view/#{vname}", params if keys CouchRest.post(url, {:keys => keys}) else if block_given? - @streamer.view(name, params, &block) + @streamer.view("_design/#{dname}/_view/#{vname}", params, &block) else CouchRest.get url end