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

prefix private methods with underscore - store.js #3254

Closed
wants to merge 5 commits into from

Conversation

gevious
Copy link

@gevious gevious commented Jun 8, 2015

Closes #3250

@gevious
Copy link
Author

gevious commented Jun 8, 2015

My tests pass sporadically. I get some issues relating to semaphore every now and then. I'm not sure what to do about that.

@private
@param {InternalModel} internalModel
*/
recordWasError: function(internalModel) {
_recordWasError: function(internalModel) {
Ember.deprecate('_recordWasError was documented as private and will be removed in the next version of Ember Data.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep the underscore method working, and create a new method called recordWasError that calls the previous one:

recordWasError: function(internalModel) {
  Ember.deprecate('message');
  return this._recordWasError(internalModel);
}

@fivetanley
Copy link
Member

@gevious It seems my instructions weren't clear, sorry. When we deprecate a method, we still want people to be able to call it until it gets removed. I left an example here https://github.com/emberjs/data/pull/3254/files#r31911784

@gevious
Copy link
Author

gevious commented Jun 8, 2015

Ah, yes. I clearly wasn't thinking this morning. What should I do with the tests, @fivetanley. I've updated them for the new methods. Should I create parallel tests for the deprecated ones? Ie should I have test cases for the deprecated methods along with the new ones?

@gevious
Copy link
Author

gevious commented Jun 8, 2015

I've kept the tests the same, but reinserted the deprecated methods. This means the deprecated methods aren't used in the test suite, but the new private methods are.If the new api is used internally, this shouldn't cause any problems going forward.

return this.findRecord(modelName, id, preload);
},
findById: function(modelName, id, preload) {
Ember.deprecate('findById was documented as private and will be removed in the next version of Ember Data.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to change this deprecation message to the one in _findById.

@gevious
Copy link
Author

gevious commented Jun 8, 2015

I've made the changes. I've included a deprecation warning for recordForId to point to getById. I think we can always change that once the RFC is approved and peekRecord is official.

Also, I've left init as is. I wasn't sure what to do with it. I'm happy to change it if need be, @fivetanley

@HeroicEric
Copy link
Member

@gevious peekRecord is now in master #3209

@bmac
Copy link
Member

bmac commented Oct 12, 2015

Hi @gevious. Thanks for doing all the work on this pr.

Unfortunately, I'm going to close it because since Ember Data 2.0 is released, I think we missed the opportunity to make this change in a semver compatible way.

Feel free to re-open if you disagree.

@bmac bmac closed this Oct 12, 2015
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