A model class with an activerecordy api. Has properties, validations, find methods, where methods etc.
It is designed to be used through node or browserify; so npm is the only way to get it:
$ npm install ryggrad-model --save
Declare a class with some properties:
class Cat extends Model
@properties 'name', 'fur_level'
validate: ->
"Name required" unless @name
Then add some cats:
cat = Cat.create(name: "Oliver")
cat2 = Cat.create(name: "Revilo, Clone")
Find a cat by name:
cat = Cat.findWhere(name: "Oliver")
console.log cat # => {name: "Oliver"}
See spec/spec.coffee for further usage examples.