lib/couch/generators/validation/validation_generator.rb in couch-0.0.4 vs lib/couch/generators/validation/validation_generator.rb in couch-0.1.0
- old
+ new
@@ -1,8 +1,13 @@
require 'couch/generators/named_base'
module Couch::Generators
class ValidationGenerator < NamedBase
+ def create_validate_doc_update
+ return if File.exists?(File.join(destination_root, "validate_doc_update.js"))
+ template "validate_doc_update.js"
+ end
+
def inject_validations
inject_into_file "validate_doc_update.js", model_validations, :after => "function (newDoc, oldDoc, userCtx) {\n"
end
protected