Class: WingedCouch::Design::Validation

Inherits:
Object
  • Object
show all
Defined in:
lib/winged_couch/design/validation.rb

Overview

Class for uploading validation functions to CouchDB

Constant Summary collapse

DOC_ID =

Default Id of validation document

"_design/validation"

Class Method Summary collapse

Class Method Details

.upload(database, name, validation) ⇒ Object

Uploads vadlition function to CouchDB


19
20
21
22
23
24
25
26
# File 'lib/winged_couch/design/validation.rb', line 19

def upload(database, name, validation)
  data = {
    _id: [DOC_ID, name].join("_"),
    validate_doc_update: validation
  }
  doc = Native::Document.new(database, data)
  doc.save
end