fix for design doc url changes
This commit is contained in:
parent
bfff491202
commit
b3a6a081fd
|
@ -61,12 +61,15 @@ module CouchRest
|
||||||
# paramaters as described in http://wiki.apache.org/couchdb/HttpViewApi
|
# paramaters as described in http://wiki.apache.org/couchdb/HttpViewApi
|
||||||
def view(name, params = {}, &block)
|
def view(name, params = {}, &block)
|
||||||
keys = params.delete(:keys)
|
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
|
if keys
|
||||||
CouchRest.post(url, {:keys => keys})
|
CouchRest.post(url, {:keys => keys})
|
||||||
else
|
else
|
||||||
if block_given?
|
if block_given?
|
||||||
@streamer.view(name, params, &block)
|
@streamer.view("_design/#{dname}/_view/#{vname}", params, &block)
|
||||||
else
|
else
|
||||||
CouchRest.get url
|
CouchRest.get url
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue