Skip to content

Instantly share code, notes, and snippets.

@HPieters
Last active December 20, 2015 05:29
Show Gist options
  • Save HPieters/6078918 to your computer and use it in GitHub Desktop.
Save HPieters/6078918 to your computer and use it in GitHub Desktop.
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return App.Pools.find();
}
});
App.ApplicationController = Ember.Controller.extend({
init: function() {
/* Ow boy this feels so wrong */
App.Pools.find();
App.Pools.find({}).then(function(obj) {
var length = App.Pools.all().content.length;
App.Global.set('pools', length);
});
App.Server.find();
App.Server.find({}).then(function(obj) {
var length = App.Server.all().content.length;
App.Global.set('number', length);
});
}
});
App.Pools = DS.Model.extend({
poolName: DS.attr('string'),
servers: DS.hasMany('App.Server')
});
App.Server = DS.Model.extend({
hostUrl: DS.attr('string'),
pool: DS.belongsTo('App.Pools')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment