fix for design doc url changes
This commit is contained in:
parent
2aeb90721e
commit
7b03c7ba25
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue