Skip to content

Instantly share code, notes, and snippets.

@buritica
Created April 27, 2014 00:30
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 buritica/11334711 to your computer and use it in GitHub Desktop.
Save buritica/11334711 to your computer and use it in GitHub Desktop.
Ember Example
{
"collection": [
{
"_id": 1,
"title": "Spring 2014",
"active": true,
"code": "SP14",
"image": "http://ec.dev/collection.jpg",
"products": [
{
"_id": 2,
"title": "Taylor",
"collection": 1,
"images": [
{
"url": "http://ec.dev/look1.jpg"
},
{
"url": "http://ec.dev/look2.jpg"
},
{
"url": "http://ec.dev/look3.jpg"
}
],
"thumbnails": {
"small": {
"url": "http://ec.dev/small.jpg"
},
"large": {
"url": "http://ec.dev/large.jpg"
}
},
"detail": {
"description": "<p>Sumus tam adultis. Non est enim tibi nescio fingunt. Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. Non est enim tibi nescio fingunt. </p><p>Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. In tuo positum, idem fecissem. Constitutione, quam molesta est mihi.</p>",
"fabric": "100% Cotton",
"color": "White",
"care": "Machine washable. Dryer safe.",
"sheerness": 7,
"measurements": [
[
"Bust",
34,
36,
38,
40,
42,
44,
46,
48,
50
],
[
"Waist",
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
"Bottom Opening",
38,
40,
42,
44,
46,
48,
50,
52,
54
],
[
"Center Back Length",
22,
24,
26,
28,
30,
32,
34,
36,
38
],
[
"Neck Drop",
5.5,
7.5,
9.5,
11.5,
13.5,
15.5,
17.5,
19.5,
21.5
],
[
"Sleeve Length",
24,
26,
28,
30,
32,
34,
36,
38,
40
],
[
"Shoulder Width",
16,
18,
20,
22,
24,
26,
28,
30,
32
]
]
}
},
{
"_id": 3,
"title": "Warren",
"collection": 1,
"images": [
{
"url": "http://ec.dev/look1.jpg"
},
{
"url": "http://ec.dev/look2.jpg"
},
{
"url": "http://ec.dev/look3.jpg"
}
],
"thumbnails": {
"small": {
"url": "http://ec.dev/small.jpg"
},
"large": {
"url": "http://ec.dev/large.jpg"
}
},
"detail": {
"description": "<p>Sumus tam adultis. Non est enim tibi nescio fingunt. Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. Non est enim tibi nescio fingunt. </p><p>Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. In tuo positum, idem fecissem. Constitutione, quam molesta est mihi.</p>",
"fabric": "100% Cotton",
"color": "White",
"care": "Machine washable. Dryer safe.",
"sheerness": 7,
"measurements": [
[
"Bust",
34,
36,
38,
40,
42,
44,
46,
48,
50
],
[
"Waist",
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
"Bottom Opening",
38,
40,
42,
44,
46,
48,
50,
52,
54
],
[
"Center Back Length",
22,
24,
26,
28,
30,
32,
34,
36,
38
],
[
"Neck Drop",
5.5,
7.5,
9.5,
11.5,
13.5,
15.5,
17.5,
19.5,
21.5
],
[
"Sleeve Length",
24,
26,
28,
30,
32,
34,
36,
38,
40
],
[
"Shoulder Width",
16,
18,
20,
22,
24,
26,
28,
30,
32
]
]
}
}
]
},
{
"_id": 0,
"title": "Forever",
"active": true,
"code": "FC",
"image": "http://ec.dev/forever-collection.jpg",
"products": [
{
"_id": 0,
"title": "Fey",
"collection": 0,
"images": [
{
"url": "http://ec.dev/look1.jpg"
},
{
"url": "http://ec.dev/look2.jpg"
},
{
"url": "http://ec.dev/look3.jpg"
}
],
"thumbnails": {
"small": {
"url": "http://ec.dev/small.jpg"
},
"large": {
"url": "http://ec.dev/large.jpg"
}
},
"detail": {
"description": "<p>Sumus tam adultis. Non est enim tibi nescio fingunt. Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. Non est enim tibi nescio fingunt. </p><p>Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. In tuo positum, idem fecissem. Constitutione, quam molesta est mihi.</p>",
"fabric": "100% Cotton",
"color": "White",
"care": "Machine washable. Dryer safe.",
"sheerness": 7,
"measurements": [
[
"Bust",
34,
36,
38,
40,
42,
44,
46,
48,
50
],
[
"Waist",
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
"Bottom Opening",
38,
40,
42,
44,
46,
48,
50,
52,
54
],
[
"Center Back Length",
22,
24,
26,
28,
30,
32,
34,
36,
38
],
[
"Neck Drop",
5.5,
7.5,
9.5,
11.5,
13.5,
15.5,
17.5,
19.5,
21.5
],
[
"Sleeve Length",
24,
26,
28,
30,
32,
34,
36,
38,
40
],
[
"Shoulder Width",
16,
18,
20,
22,
24,
26,
28,
30,
32
]
]
}
},
{
"_id": 1,
"title": "Liz Lemon",
"collection": 0,
"images": [
{
"url": "http://ec.dev/look1.jpg"
},
{
"url": "http://ec.dev/look2.jpg"
},
{
"url": "http://ec.dev/look3.jpg"
}
],
"thumbnails": {
"small": {
"url": "http://ec.dev/small.jpg"
},
"large": {
"url": "http://ec.dev/large.jpg"
}
},
"detail": {
"description": "<p>Sumus tam adultis. Non est enim tibi nescio fingunt. Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. Non est enim tibi nescio fingunt. </p><p>Confusio esse cupio. Scio te debeo meae. At etiam, ut caveant ab his eu. In tuo positum, idem fecissem. Constitutione, quam molesta est mihi.</p>",
"fabric": "100% Cotton",
"color": "White",
"care": "Machine washable. Dryer safe.",
"sheerness": 7,
"measurements": [
[
"Bust",
34,
36,
38,
40,
42,
44,
46,
48,
50
],
[
"Waist",
27,
29,
31,
33,
35,
37,
39,
41,
43
],
[
"Bottom Opening",
38,
40,
42,
44,
46,
48,
50,
52,
54
],
[
"Center Back Length",
22,
24,
26,
28,
30,
32,
34,
36,
38
],
[
"Neck Drop",
5.5,
7.5,
9.5,
11.5,
13.5,
15.5,
17.5,
19.5,
21.5
],
[
"Sleeve Length",
24,
26,
28,
30,
32,
34,
36,
38,
40
],
[
"Shoulder Width",
16,
18,
20,
22,
24,
26,
28,
30,
32
]
]
}
}
]
}
]
}
Sorry, Something went wrong
Assertion Failed: The response from a findAll must be an Array, not undefined
Error: Assertion Failed: The response from a findAll must be an Array, not undefined
at new Error (native)
at Error.Ember.Error (http://localhost:8000/vendor/ember/ember.js:910:19)
at Object.Ember.assert (http://localhost:8000/vendor/ember/ember.js:73:11)
at http://localhost:8000/vendor/ember-data/ember-data.js:10398:15
at invokeCallback (http://localhost:8000/vendor/ember/ember.js:10013:19)
at publish (http://localhost:8000/vendor/ember/ember.js:9683:9)
at publishFulfillment (http://localhost:8000/vendor/ember/ember.js:10103:7)
at http://localhost:8000/vendor/ember/ember.js:18379:7
at Object.DeferredActionQueues.flush (http://localhost:8000/vendor/ember/ember.js:6127:24)
at Object.Backburner.end (http://localhost:8000/vendor/ember/ember.js:6215:27)
//models/collection.js
var attr = DS.attr;
var Collection = DS.Model.extend({
title: attr('string'),
active: attr('boolean'),
code: attr('string'),
image: attr('string'),
products: DS.hasMany('product', {embedded: 'always'})
});
export default Collection;
//models/product.js
var attr = DS.attr;
var Product = DS.Model.extend({
title: attr('string'),
collection: DS.belongsTo('collection')
});
export default Product;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment