From 97c5cfd6443c9e38e74adcfca9f5f229000cfa33 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 28 Feb 2014 22:29:22 -0800 Subject: [PATCH] Fix the example for scope --- examples/datasource-app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/datasource-app.js b/examples/datasource-app.js index 55f40cd0..215ad986 100644 --- a/examples/datasource-app.js +++ b/examples/datasource-app.js @@ -51,7 +51,7 @@ Post.belongsTo(User, {as: 'author', foreignKey: 'userId'}); User.hasAndBelongsToMany('groups'); -var user2 = new User({name: 'Smith'}); +var user2 = new User({name: 'Smith', age: 14}); user2.save(function (err) { console.log(user2); var post = user2.posts.build({title: 'Hello world'}); @@ -64,7 +64,7 @@ Post.findOne({where: {published: false}, order: 'date DESC'}, function (err, dat console.log(data); }); -User.create({name: 'Jeff'}, function (err, data) { +User.create({name: 'Jeff', age: 12}, function (err, data) { if (err) { console.log(err); return; @@ -78,7 +78,7 @@ User.create({name: 'Ray'}, function (err, data) { console.log(data); }); -User.scope('minors', {age: {le: 16}}); +User.scope('minors', {where: {age: {lte: 16}}, include: 'posts'}); User.minors(function (err, kids) { console.log('Kids: ', kids); });