Last active
September 5, 2017 14:38
-
-
Save Leooo/305861d9a5e157117f350afa59215cb0 to your computer and use it in GitHub Desktop.
bug-relationship-resolve-after-api-fail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//import Collection from 'ember-cli-mirage/orm/collection'; | |
import Mirage from 'ember-cli-mirage'; | |
export default function() { | |
window.server = this; | |
this.get('/child/:id', function(schema, request){ | |
return new Mirage.Response(404, {}, { | |
status: 'FAIL', | |
data: {}, | |
errors: [ | |
{ | |
code: 'child', | |
message: 'bla' | |
} | |
], | |
meta: {} | |
}); | |
}); | |
this.get('/parents', function({customers}, request){ | |
return { | |
data: this.serialize(customers.all()) | |
} | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { hasMany, belongsTo } from 'ember-cli-mirage'; | |
import { Model } from 'ember-cli-mirage'; | |
export default Model.extend({ | |
parent: belongsTo() | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { hasMany, belongsTo } from 'ember-cli-mirage'; | |
import { Model } from 'ember-cli-mirage'; | |
export default Model.extend({ | |
child: belongsTo() | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
parent: belongsTo('parent') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
child: belongsTo('child') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
//store: Ember.inject.service(), | |
model() { | |
console.log('store', this.get('store')); | |
//let parent = this.get('store').createRecord('parent', {}); | |
let parents = $.get('/parents'); | |
return parent.constructor; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"ENV": { | |
"ember-cli-mirage": { | |
"enabled": true | |
} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.10.2", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-cli-mirage": "0.2.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment