Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update validations stuff in README

  • Loading branch information...
commit 8abce47c8e87a21bb87d597b4d9830b04a71bad3 1 parent c282cc4
@1602 authored
Showing with 12 additions and 1 deletion.
  1. +12 −1 README.md
View
13 README.md
@@ -76,9 +76,20 @@ User.count(cb)
user.destroy(cb);
// destroy all instances
User.destroyAll(cb);
+
+// Setup validations
+User.validatesPresenceOf('name', 'email')
+User.validatesLengthOf('password', {min: 5, message: {min: 'Password is too short'}});
+User.validatesInclusionOf('gender', {in: ['male', 'female']});
+User.validatesExclusionOf('domain', {in: ['www', 'billing', 'admin']});
+User.validatesNumericalityOf('age', {int: true});
+
+user.isValid() // false
+user.errors // hash of errors {attr: [errmessage, errmessage, ...], attr: ...}
```
Read the tests for usage examples: ./test/common_test.js
+Validations: ./test/validations_test.js
## Your own database adapter
@@ -107,7 +118,7 @@ of course, if you have redis running, you can run
## Package structure
-Now all common logic described in ./index.js, and database-specific stuff in ./lib/*.js. It's super-tiny, right?
+Now all common logic described in `./lib/*.js`, and database-specific stuff in `./lib/adapters/*.js`. It's super-tiny, right?
## Project status
Please sign in to comment.
Something went wrong with that request. Please try again.