Browse files

[examples] Update all examples wrt to new api

  • Loading branch information...
1 parent 14744af commit fc0671e28969aaa133cacf4670ec00e248f9ba50 @pksunkara pksunkara committed Jul 9, 2012
View
2 examples/create.js
@@ -5,7 +5,7 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak'
+ id: 'Marak'
}, function(err, marak){
console.log(marak);
});
View
2 examples/destroy.js
@@ -5,7 +5,7 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak'
+ id: 'Marak'
}, function(err, marak){
Author.destroy('Marak', function(err, result){
Author.get('Marak', function(err, result){
View
2 examples/find.js
@@ -5,7 +5,7 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak',
+ id: 'Marak',
name: "brown"
}, function(err, marak){
Author.find({name: "brown"}, function(err, result){
View
2 examples/get.js
@@ -5,7 +5,7 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak'
+ id: 'Marak'
}, function(err, marak){
//
// "marak" exists already in scope from the create
View
6 examples/relationship-one-to-many.js
@@ -19,20 +19,20 @@ Article.parent('author');
// Create a new author "bob"
//
Author.create({
- _id: 'bob'
+ id: 'bob'
}, function(err, bob){
//
// Create a new article for bob
//
- bob.createArticle({ _id: "cool-story", title: "A cool story by bob." }, function(err, result){
+ bob.createArticle({ id: "cool-story", title: "A cool story by bob." }, function(err, result){
console.log(bob.article_ids);
//
// Get all of bob's articles
//
bob.articles(function(err, result){
console.log(result);
});
- Article.get('bob/cool-story', function(err, result){
+ Article.get('author/bob/cool-story', function(err, result){
console.log(result);
})
});
View
18 examples/relationship-parent-child.js
@@ -9,18 +9,18 @@ var Category = resourceful.define('category');
Category.parent('category');
Category.create({
- _id: 'music',
+ id: 'music',
}, function(err, music){
music.createCategory({
- _id: 'hip-hop',
+ id: 'hip-hop',
}, function(err, hiphop){
music.createCategory({
- _id: 'rap',
+ id: 'rap',
}, function(err, rap){
- hiphop.createCategory({ _id: "a-tribe-called-quest", title: "Hello!" }, function(err, result){
- hiphop.createCategory({ _id: "busta-rhymes", title: "Hello!" }, function(err, busta){
- rap.createCategory({ _id: "wu-tang", title: "Hello!" }, function(err, wutang){
- wutang.createCategory({ _id: "Enter the 36 Chambers", title: "Hello!" }, function(err, result){
+ hiphop.createCategory({ id: "a-tribe-called-quest", title: "Hello!" }, function(err, result){
+ hiphop.createCategory({ id: "busta-rhymes", title: "Hello!" }, function(err, busta){
+ rap.createCategory({ id: "wu-tang", title: "Hello!" }, function(err, wutang){
+ wutang.createCategory({ id: "Enter the 36 Chambers", title: "Hello!" }, function(err, result){
music.categories(function(err, result){
console.log('music', err, result);
});
@@ -36,8 +36,8 @@ Category.create({
Category.categories('music', function(err, result){
console.log('music', result)
});
- Category.categories('music/rap', function(err, result){
- console.log('music/rap', result)
+ Category.categories('category/music/rap', function(err, result){
+ console.log('category/music/rap', result)
});
});
});
View
4 examples/save.js
@@ -5,10 +5,10 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak'
+ id: 'Marak'
}, function(err, marak){
marak.name = "foobar";
marak.save(function(err, result){
console.log(err, result);
})
-});
+});
View
2 examples/update.js
@@ -5,7 +5,7 @@ var Author = resourceful.define('author');
Author.string('name');
Author.create({
- _id: 'Marak',
+ id: 'Marak',
name: 'foobar'
}, function(err, marak){
marak.update({ name: 'barfoo'}, function(err, result){

0 comments on commit fc0671e

Please sign in to comment.