Closed lucas-clemente closed 9 years ago
I see. It works for my (limited) scenario, but I don't understand the details ;)
This works fine as long as your using 2.0.0 https://github.com/emberjs/ember.js/pull/12028
Looks like two different errors here: Not using `_actions´ doesn't work with the way we reopen the routes (or something else is wrong) in versions prior to 2.0.0. Also, on the release-version, there is a error in the test:
beforeEach failed on it sets document title on the renderer:-dom if present: 'undefined' is not a function (evaluating 'registry.register('location:none', Ember['default'].NoneLocation)')
You need to detect the merged property name, and use that. For 1.x it will be _actions
and 2.x it will be actions
. There may be an easier way, but this is what I whipped up:
var mergedActionPropertyName = (function() {
var routeProto = Ember.Route.proto();
var mergedProps = routeProto.mergedProperties;
for (var i = 0, l = mergedProps.length; i < l; i++) {
var property = mergedProps[i];
if (property === 'actions') {
return 'actions';
} else if (property === '_actions') {
return '_actions';
}
}
})();
var routeProps = {};
routeProps[mergedActionPropertyName] = {
// actions here
};
App.IndexRoute = Ember.Route.extend(routeProps);
@kimroen - https://github.com/kimroen/ember-cli-document-title/pull/25 should address the error with registry.register
.
Working on this, but just as a note: the functionality itself does seem to be working without any changes.
Thanks for contributing, and thanks to @rwjblue for the great suggested fix. Releasing a new version shortly which should take care of this.
Thanks for fixing it, and sorry for not working with you to improve my initial fix. I was caught with other stuff :S
@lucas-clemente Don't worry about it — I know the feeling :)
I'm not sure it's as straight forward as just replacing it (because we are reopening the class), but I'll take a look some time in the coming week unless you do first :)