#view method works when auto_update_design_doc is disabled

This commit is contained in:
Peter Williams 2011-11-16 15:30:46 -07:00
parent f28cce1f0a
commit f2c16144b0
2 changed files with 20 additions and 3 deletions

View file

@ -58,10 +58,11 @@ module CouchRest
self.model = model
end
# Define a view and generate a method that will provide a new
# View instance when requested.
# Generate a method that will provide a new View instance when
# requested. This will also define the view in CouchDB unless
# auto_update_design_doc is disabled.
def view(name, opts = {})
View.create(model, name, opts)
View.create(model, name, opts) if model.auto_update_design_doc
create_view_method(name)
end