Skip to content

Commit

Permalink
fix for design doc url changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Anderson committed Mar 9, 2009
1 parent 2aeb907 commit 7b03c7b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/couchrest/core/database.rb
Expand Up @@ -61,12 +61,15 @@ def slow_view(funcs, params = {})
# 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
Expand Down

1 comment on commit 7b03c7b

@jchris
Copy link
Owner

@jchris jchris commented on 7b03c7b Mar 9, 2009

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See http://wiki.apache.org/couchdb/Breaking_changes for reason why.

Please sign in to comment.