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

[BUGFIX release] Do not register the service store when it has already been registered #3460

Merged

Conversation

ppcano
Copy link
Contributor

@ppcano ppcano commented Jun 29, 2015

The following change remove the need of the service:store registration after the store initializer like:

import ApplicationStore from 'app/data/store';

export default {
  name: 'setup-store',
  after: ['store'],

  initialize: function(registry, application) {
    registry.register('service:store', ApplicationStore);
  }
};

Now, the service:store could be registered either before or after the store initializer.

@bmac
Copy link
Member

bmac commented Jun 29, 2015

Hi @ppcano. Do you mind sharing a little more info about your usecase?

In Ember Data 1.13 the supported way to define a custom ApplicationStore is to define it in app/services/store.js so it gets registered as service:store automatically.

@ppcano
Copy link
Contributor Author

ppcano commented Jun 29, 2015

@bmac, my use case is that we are NOT still using ember-cli. So our initializer/registration process differs a little of the standard ember-cli.

I know the ED/EM position and understand/agree if this change is not included. I wanted to share our specific case.

@bmac
Copy link
Member

bmac commented Jun 29, 2015

That seems reasonable @ppcano. Do you mind adding a test for this functionality?

Here is an existing test that uses an initializer to help you get started

test("ember-data initializer is run", function() {
var ran = false;
App.initializer({
name: "after-ember-data",
after: "ember-data",
initialize: function() { ran = true; }
});
run(function() {
app = App.create();
});
ok(ran, 'ember-data initializer was found');
});
.

@ppcano ppcano force-pushed the optionally-skip-store-registration branch from b5a081e to c71c525 Compare June 29, 2015 12:34
@ppcano
Copy link
Contributor Author

ppcano commented Jun 29, 2015

@bmac, done.

@bmac
Copy link
Member

bmac commented Jun 29, 2015

Awesome. Do you mind also updating the commit message to start with [BUGFIX release] so we can make sure this is included in the next patch release for Ember Data 1.13?

@ppcano ppcano force-pushed the optionally-skip-store-registration branch from c71c525 to 3c96368 Compare June 29, 2015 12:39
@ppcano ppcano changed the title Do not register the service store when it has already been registered [BUGFIX release] Do not register the service store when it has already been registered Jun 29, 2015
@ppcano
Copy link
Contributor Author

ppcano commented Jun 29, 2015

Commit and pull request title changed.

@bmac
Copy link
Member

bmac commented Jun 29, 2015

Thanks

bmac added a commit that referenced this pull request Jun 29, 2015
…ration

[BUGFIX release] Do not register the service store when it has already been registered
@bmac bmac merged commit 051d5a7 into emberjs:master Jun 29, 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.

2 participants