I have a subdomain look up inside my index route. It looks up a plan for the subdomain slug and redirects to the plan page. If no plan returns it needs to render the 404 page. Here is the code for the redirect. Admittedly I'm new to ember, but this code seems to be correct. I get zero errors in the console and it simply goes to the route I'm trying to redirect away from:
controller/index.js
model: function() {
var self = this;
if ( this.isHomePage() ) {
return Ember.Object.create();
} else {
// Get resources
var parts = window.location.hostname.split('.');
var subdomain = parts[0];
return this.store.find('plan', { plan_subdomain: subdomain }).then(function(plans) {
var returnedPlan = plans.get('firstObject');
if (Ember.isEmpty(returnedPlan)){
debugger;
return self.transitionTo('fourOhFour');
} else {
return returnedPlan;
}
});
}
},
router.js
this.route("fourOhFour", { path: "*path"});