fixed class proxy design doc wreidness
This commit is contained in:
parent
3ee810010d
commit
4d4972f0de
|
@ -104,7 +104,7 @@ module CouchRest
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_design_doc
|
def refresh_design_doc
|
||||||
@klass.refresh_design_doc
|
@klass.refresh_design_doc_on(@database)
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_design_doc
|
def save_design_doc
|
||||||
|
|
|
@ -48,6 +48,11 @@ module CouchRest
|
||||||
save_design_doc
|
save_design_doc
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def refresh_design_doc_on(db)
|
||||||
|
reset_design_doc
|
||||||
|
save_design_doc_on(db)
|
||||||
|
end
|
||||||
|
|
||||||
# Save the design doc onto the default database, and update the
|
# Save the design doc onto the default database, and update the
|
||||||
# design_doc attribute
|
# design_doc attribute
|
||||||
def save_design_doc
|
def save_design_doc
|
||||||
|
|
|
@ -95,11 +95,11 @@ module CouchRest
|
||||||
|
|
||||||
# Dispatches to any named view.
|
# Dispatches to any named view.
|
||||||
def view(name, query={}, &block)
|
def view(name, query={}, &block)
|
||||||
unless design_doc_fresh
|
db = query.delete(:database) || database
|
||||||
refresh_design_doc
|
unless design_doc_fresh
|
||||||
|
refresh_design_doc_on(db)
|
||||||
end
|
end
|
||||||
query[:raw] = true if query[:reduce]
|
query[:raw] = true if query[:reduce]
|
||||||
db = query.delete(:database) || database
|
|
||||||
raw = query.delete(:raw)
|
raw = query.delete(:raw)
|
||||||
fetch_view_with_docs(db, name, query, raw, &block)
|
fetch_view_with_docs(db, name, query, raw, &block)
|
||||||
end
|
end
|
||||||
|
|
|
@ -200,7 +200,7 @@ describe "ExtendedDocument views" do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
reset_test_db!
|
reset_test_db!
|
||||||
# setup the class default doc to save the design doc
|
# setup the class default doc to save the design doc
|
||||||
Unattached.use_database DB
|
Unattached.use_database nil # just to be sure it is really unattached
|
||||||
@us = Unattached.on(DB)
|
@us = Unattached.on(DB)
|
||||||
%w{aaa bbb ddd eee}.each do |title|
|
%w{aaa bbb ddd eee}.each do |title|
|
||||||
u = @us.new(:title => title)
|
u = @us.new(:title => title)
|
||||||
|
|
Loading…
Reference in a new issue