Skip to content

Instantly share code, notes, and snippets.

@wmill
Last active December 23, 2015 02:29
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 wmill/6567080 to your computer and use it in GitHub Desktop.
Save wmill/6567080 to your computer and use it in GitHub Desktop.
This is a update for the "Fire Up Ember.js" screencast from peepcode. It makes things work with Ember.js 1.0. Apply to app.js and update the js file links in index.html. Tested with the following: Ember.VERSION : 1.0.0 Handlebars.VERSION : 1.0.0 jQuery.VERSION : 1.9.1 Ember Data VERSION : v1.0.0-beta.2
--- peepcode-ember-final/js/app.js 2013-02-23 00:37:57.000000000 -0500
+++ peepcode-ember-starter-app/js/app.js 2013-09-14 20:50:24.000000000 -0400
@@ -17,13 +17,13 @@
App.ApplicationRoute = Ember.Route.extend({
setupController: function() {
- this.controllerFor('food').set('model', App.Food.find());
+ this.controllerFor('food').set('model', this.store.find('food'));
}
});
App.TablesRoute = Ember.Route.extend({
model: function() {
- return App.Table.find();
+ return this.store.find('table');
}
});
@@ -55,17 +55,16 @@
// Models
-App.Store = DS.Store.extend({
- revision: 11,
- adapter: 'DS.FixtureAdapter'
-});
+
+App.ApplicationAdapter = DS.FixtureAdapter;
+
App.Table = DS.Model.extend({
- tab: DS.belongsTo('App.Tab')
+ tab: DS.belongsTo('tab')
});
App.Tab = DS.Model.extend({
- tabItems: DS.hasMany('App.TabItem'),
+ tabItems: DS.hasMany('tabItem'),
cents: function() {
return this.get('tabItems').getEach('cents').reduce(function(accum, item) {
return accum + item;
@@ -75,7 +74,7 @@
App.TabItem = DS.Model.extend({
cents: DS.attr('number'),
- food: DS.belongsTo('App.Food')
+ food: DS.belongsTo('food')
});
App.Food = DS.Model.extend({
@@ -115,7 +114,8 @@
tabItems: []
}, {
id: 4,
- tabItems: [400, 401, 402, 403, 404]
+ //for some reason it does not like you specifying tabItem ids here
+ tabItems: []
}, {
id: 5,
tabItems: []
@@ -171,4 +171,4 @@
name: 'Birthday Cake',
imageUrl: 'img/birthdaycake.png',
cents: 2000
-}];
+}];
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment