Forked from marialomidze/controllers.application.js
Last active
March 14, 2018 16:15
-
-
Save ASH-Anthony/f05a49ee40de197fd62e9aeb51fd9f8a to your computer and use it in GitHub Desktop.
Mirage one-to-one
This file contains hidden or 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 Mirage from 'ember-cli-mirage'; | |
| export default function() { | |
| window.server = this; | |
| this.get('bosses/:id'); | |
| }; |
This file contains hidden or 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 { Factory } from 'ember-cli-mirage'; | |
| export default Factory.extend({ | |
| name: 'Michael Scott', | |
| companyCar: 'Chrysler Sebring', | |
| afterCreate(boss, server){ | |
| server.create('girlfriend', {boss}) | |
| } | |
| }); |
This file contains hidden or 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 { Factory } from 'ember-cli-mirage'; | |
| export default Factory.extend({ | |
| name: 'Jan Levinson', | |
| candlesCount:faker.random.number({min:3000, max:10000}) | |
| }); |
This file contains hidden or 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
| export default function(server) { | |
| server.createList('boss', 1); | |
| } |
This file contains hidden or 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 { RestSerializer } from 'ember-cli-mirage'; | |
| export default RestSerializer.extend({ | |
| }); |
This file contains hidden or 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 BaseSerializer from './application'; | |
| export default BaseSerializer.extend({ | |
| include: ['girlfriend'] | |
| }); |
This file contains hidden or 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 DS from 'ember-data'; | |
| export default DS.Model.extend({ | |
| name: DS.attr('string'), | |
| companyCar: DS.attr('string'), | |
| girlfriend: DS.belongsTo() | |
| }); |
This file contains hidden or 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 DS from 'ember-data'; | |
| export default DS.Model.extend({ | |
| name: DS.attr('string'), | |
| candlesCount:DS.attr('number'), | |
| boss: DS.belongsTo() | |
| }); |
This file contains hidden or 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({ | |
| model() { | |
| return this.store.findRecord('boss', 1 ); | |
| } | |
| }); |
This file contains hidden or 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 DS from 'ember-data'; | |
| export default DS.RESTSerializer.extend({ | |
| }); |
This file contains hidden or 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 Base from './application'; | |
| export default Base.extend({ | |
| }); |
This file contains hidden or 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.10.7", | |
| "ENV": { | |
| "ember-cli-mirage": { | |
| "enabled": true | |
| } | |
| }, | |
| "EmberENV": { | |
| "FEATURES": { | |
| "ds-finder-include": 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.0", | |
| "ember-data": "2.10.0", | |
| "ember-template-compiler": "2.10.0", | |
| "ember-testing": "2.10.0" | |
| }, | |
| "addons": { | |
| "ember-cli-mirage": "0.3.2" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment