Skip to content

Instantly share code, notes, and snippets.

@olivernn
Created December 1, 2010 12:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olivernn/723422 to your computer and use it in GitHub Desktop.
Save olivernn/723422 to your computer and use it in GitHub Desktop.
User with validation on presence of name
var User = Model('user', {
// class methods
validates: {
presenceOf: ['name']
}
}, {
// instance methods
})
o = new User ({name: "oliver"})
u.valid() -> true
b = new User ()
b.valid() -> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment