Class proxy was not setting database on result sets
This commit is contained in:
parent
17dac85a02
commit
6d571a7d81
2 changed files with 58 additions and 24 deletions
|
@ -56,7 +56,9 @@ module CouchRest
|
|||
# Mixins::DocumentQueries
|
||||
|
||||
def all(opts = {}, &block)
|
||||
@klass.all({:database => @database}.merge(opts), &block)
|
||||
docs = @klass.all({:database => @database}.merge(opts), &block)
|
||||
docs.each { |doc| doc.database = @database if doc.respond_to?(:database) } if docs
|
||||
docs
|
||||
end
|
||||
|
||||
def count(opts = {}, &block)
|
||||
|
@ -64,11 +66,15 @@ module CouchRest
|
|||
end
|
||||
|
||||
def first(opts = {})
|
||||
@klass.first({:database => @database}.merge(opts))
|
||||
doc = @klass.first({:database => @database}.merge(opts))
|
||||
doc.database = @database if doc && doc.respond_to?(:database)
|
||||
doc
|
||||
end
|
||||
|
||||
def get(id)
|
||||
@klass.get(id, @database)
|
||||
doc = @klass.get(id, @database)
|
||||
doc.database = @database if doc && doc.respond_to?(:database)
|
||||
doc
|
||||
end
|
||||
|
||||
# Mixins::Views
|
||||
|
@ -78,7 +84,9 @@ module CouchRest
|
|||
end
|
||||
|
||||
def view(name, query={}, &block)
|
||||
@klass.view(name, {:database => @database}.merge(query), &block)
|
||||
docs = @klass.view(name, {:database => @database}.merge(query), &block)
|
||||
docs.each { |doc| doc.database = @database if doc.respond_to?(:database) } if docs
|
||||
docs
|
||||
end
|
||||
|
||||
def all_design_doc_versions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue