Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation by replacing _actions with actions #22

Closed
wants to merge 1 commit into from

Conversation

lucas-clemente
Copy link

No description provided.

@kimroen
Copy link
Owner

kimroen commented Aug 11, 2015

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 :)

@lucas-clemente
Copy link
Author

I see. It works for my (limited) scenario, but I don't understand the details ;)

@gpoitch
Copy link
Contributor

gpoitch commented Aug 15, 2015

This works fine as long as your using 2.0.0 emberjs/ember.js#12028

@kimroen
Copy link
Owner

kimroen commented Aug 19, 2015

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)')

john-kurkowski added a commit to john-kurkowski/yoshinom that referenced this pull request Aug 22, 2015
Although it wasn't in my code, should've taken the _actions deprecation more seriously. Track the proper release of a fix in kimroen/ember-cli-document-title#22
@rwjblue
Copy link
Contributor

rwjblue commented Aug 23, 2015

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);

Demo: http://emberjs.jsbin.com/huxuwu/1/edit?html,js,output

@rwjblue
Copy link
Contributor

rwjblue commented Aug 23, 2015

@kimroen - #25 should address the error with registry.register.

@kimroen
Copy link
Owner

kimroen commented Aug 23, 2015

Working on this, but just as a note: the functionality itself does seem to be working without any changes.

@kimroen kimroen mentioned this pull request Aug 23, 2015
@kimroen
Copy link
Owner

kimroen commented Aug 23, 2015

Thanks for contributing, and thanks to @rwjblue for the great suggested fix. Releasing a new version shortly which should take care of this.

@kimroen kimroen closed this Aug 23, 2015
@lucas-clemente
Copy link
Author

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 lucas-clemente deleted the actions branch August 24, 2015 12:44
@kimroen
Copy link
Owner

kimroen commented Aug 24, 2015

@lucas-clemente Don't worry about it — I know the feeling :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants