fixed the refresh design doc method to actually save the doc in the db
This commit is contained in:
parent
85079a54d9
commit
b1ff1192e5
|
@ -44,16 +44,14 @@ module CouchRest
|
||||||
end
|
end
|
||||||
|
|
||||||
def refresh_design_doc
|
def refresh_design_doc
|
||||||
design_doc['_id'] = design_doc_id
|
reset_design_doc
|
||||||
design_doc.delete('_rev')
|
save_design_doc
|
||||||
#design_doc.database = nil
|
|
||||||
self.design_doc_fresh = true
|
|
||||||
end
|
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
|
||||||
refresh_design_doc unless design_doc_fresh
|
reset_design_doc unless design_doc_fresh
|
||||||
self.design_doc = update_design_doc(design_doc)
|
self.design_doc = update_design_doc(design_doc)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -65,6 +63,13 @@ module CouchRest
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def reset_design_doc
|
||||||
|
design_doc['_id'] = design_doc_id
|
||||||
|
design_doc.delete('_rev')
|
||||||
|
#design_doc.database = nil
|
||||||
|
self.design_doc_fresh = true
|
||||||
|
end
|
||||||
|
|
||||||
# Writes out a design_doc to a given database, returning the
|
# Writes out a design_doc to a given database, returning the
|
||||||
# updated design doc
|
# updated design doc
|
||||||
def update_design_doc(design_doc, db = database)
|
def update_design_doc(design_doc, db = database)
|
||||||
|
|
Loading…
Reference in a new issue