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

Allow pluralization to be configurable. #68

Merged
merged 2 commits into from
Oct 9, 2014

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Oct 9, 2014

To customize provide a pluralizedTypes object to your extended version of
the Resolver:

import Resolver from 'ember/resolver';

export default Resolver.extend({
  pluralizedTypes: {
    'sheep': 'sheep'
    'config': 'config'
  }
})

@rwjblue
Copy link
Member Author

rwjblue commented Oct 9, 2014

@stefanpenner - 👍 ?

@rwjblue
Copy link
Member Author

rwjblue commented Oct 9, 2014

Also, I split the commits, you can see the actual changes in the first one (the second is just updating dist/).

To customize provide a `pluralizedTypes` object to your extended
version of the Resolver:

```javascript
import Resolver from 'ember/resolver';

export default Resolver.extend({
  pluralizedTypes: {
   'sheep': 'sheep'
   'config': 'config'
  }
})
```
@stefanpenner
Copy link
Contributor

LGTM

rwjblue added a commit that referenced this pull request Oct 9, 2014
Allow pluralization to be configurable.
@rwjblue rwjblue merged commit 8396550 into ember-cli:master Oct 9, 2014
@rwjblue rwjblue deleted the pluralization branch October 9, 2014 19:05
@rwjblue
Copy link
Member Author

rwjblue commented Oct 9, 2014

Tagged and released as 0.1.8.

@peterchoo
Copy link

👍

@christophermlne
Copy link

Where would one extend the Resolver in an Ember CLI application? I've searched but can't find anything about this in the docs or stack overflow.

@rwjblue
Copy link
Member Author

rwjblue commented Jun 30, 2015

You can put it anywhere you want then change the import in app/app.js to import your custom resolver and pass it into the app there.

@jembezmamy
Copy link

Is there a way to extend pluralizedTypes multiple times? Maybe it's more an Ember question... I'm using ember-can addon, which adds its own pluralizedTypes. Then I add my pluralizedTypes. I have to somehow merge them together. Now I use this rather awful approach:

ResolverInitializer = {
  name: "resolver",
  after: "setup-ember-can",
  initialize: function(container, application) {
    Resolver.reopen({
      pluralizedTypes: $.extend(Resolver.create().get("pluralizedTypes"), {
        search: "searches",
        "value-object": "value-objects"
      })
    });
  }
};

I'm not sure, but it seems that this pluralizedTypes implementation is hard to extend. For example if I use another addon that adds its own pluralizedTypes the same way ember-can does, they won't work together.

kratiahuja pushed a commit to kratiahuja/ember-resolver that referenced this pull request Aug 5, 2016
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.

5 participants