Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Hendrickson markmhx

View GitHub Profile
@markmhx
markmhx / gist:7749416
Last active Dec 30, 2015
I'm finding further inconsistent behavior when trying to access the model of the Application controller. In the example below, if the IndexRoute is first loaded without any user fixtures, the Application model is undefined as expected. After triggering the authenticateUser method on the IndexRoute, a new user object should be set as the Applicat…
View gist:7749416
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return this.store.find('user').then(function(users) {
return users.get('firstObject');
});
}
});
App.ApplicationController = Ember.Controller.extend({
authenticateUser: function() {
@markmhx
markmhx / gist:7722350
Last active Dec 29, 2015
Code illustrating issue where SourcesRoute fetches an undefined ApplicationController.model value even when the ApplicationRoute's model method has properly set the model value before SourcesRoute's beforeModel method is triggered, as expected with promises. While ApplicationController.model's value has been set, it's as if its value doesn't get…
View gist:7722350
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return this.store.find('user').then(function(users) {
return users.get('firstObject');
});
}
}
App.SourcesRoute = Ember.Route.extend({
beforeModel: function() {
You can’t perform that action at this time.