Last active
February 14, 2017 23:44
-
-
Save chrishowes/0daa52af83aedc3de1adcc908be2c04b to your computer and use it in GitHub Desktop.
New Twiddle
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.Controller.extend({ | |
appName: 'VisitDays' | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
firstName: attr("string"), | |
lastName: attr("string"), | |
visits: belongsTo("visit") | |
}); |
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 Model from "ember-data/model"; | |
import attr from "ember-data/attr"; | |
import { belongsTo, hasMany } from "ember-data/relationships"; | |
export default Model.extend({ | |
name: attr("string"), | |
users: hasMany("user"), | |
}); |
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({ | |
beforeModel() { | |
var user1 = this.store.createRecord("user", { | |
id: 1, | |
firstName: "First", | |
lastName: "User", | |
}); | |
var user2 = this.store.createRecord("user", { | |
id: 2, | |
firstName: "Second", | |
lastName: "User", | |
}); | |
var user3 = this.store.createRecord("user", { | |
id: 3, | |
firstName: "Third", | |
lastName: "User", | |
}); | |
var user4 = this.store.createRecord("user", { | |
id: 4, | |
firstName: "Fourth", | |
lastName: "User", | |
}); | |
var user5 = this.store.createRecord("user", { | |
id: 5, | |
firstName: "Fifth", | |
lastName: "User", | |
}); | |
var visit1 = this.store.createRecord("visit", { | |
id: 1, | |
name: "Morning Visit", | |
users: [user1, user2, user3] | |
}); | |
var visit2 = this.store.createRecord("visit", { | |
id: 2, | |
name: "Afternoon Visit", | |
users: [user4, user5] | |
}); | |
}, | |
}); |
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.5", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.8.0", | |
"ember-data": "2.8.0", | |
"ember-template-compiler": "2.8.0", | |
"ember-testing": "2.8.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment