How to properly redirect a route before the model


#1

I’m slightly confused as to where I should be putting redirects if I need them. For instance, say I have this route:

import Ember from 'ember';

export default Ember.Route.extend({
  beforeModel() {
    this.transitionTo('some-thing');
  },
});

If I do it before the model, I get this error:

ember.debug.js:16905 Error: Property set failed: object in path "model" could not be found or was destroyed.
at setPath (ember.debug.js:21386)
at Object.set (ember.debug.js:21306)
at Class.set (ember.debug.js:33930)
at route.js:45
at Class.forEach (ember.debug.js:32204)
at route.js:38
at tryCatch (ember.debug.js:58165)
at invokeCallback (ember.debug.js:58177)
at publish (ember.debug.js:58148)
at ember.debug.js:37633

Is this not the proper way of handling redirects before a model?


#2

Yes it is the proper way. It has to be something else. Perhaps try to redirect to your simplest route?