You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/v3.1.0/models/customizing-adapters.md
+11-6Lines changed: 11 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -108,7 +108,8 @@ Data comes bundled with
108
108
ActiveSupport::Inflector compatible library for inflecting words
109
109
between plural and singular forms. Irregular or uncountable
110
110
pluralizations can be specified via `Ember.Inflector.inflector`.
111
-
A common way to do this is:
111
+
To do this, create a file containing your customizations and import it
112
+
in `app.js`:
112
113
113
114
```javascript {data-filename=app/app.js}
114
115
// sets up Ember.Inflector
@@ -120,16 +121,20 @@ import Inflector from 'ember-inflector';
120
121
121
122
constinflector=Inflector.inflector;
122
123
123
-
inflector.irregular('formula', 'formulae');
124
+
// Tell the inflector that the plural of "campus" is "campuses"
125
+
inflector.irregular('campus', 'campuses');
126
+
127
+
// Tell the inflector that the plural of "advice" is "advice"
124
128
inflector.uncountable('advice');
125
129
126
-
//Meet Ember Inspector's expectation of an export
130
+
//Modules must have an export, so we just export an empty object here
127
131
exportdefault {};
128
132
```
129
133
130
-
This will tell the JSON API adapter that requests for `formula`
131
-
should go to `/formulae/1` instead of `/formulas/1`, and that
132
-
requests for `advice` should go to `/advice/1` instead of `/advices/1`.
134
+
The JSON API adapter will now make requests for `Campus` models to
135
+
`/campuses` and `/campuses/1` (instead of `/campus/` and `/campus/1`),
136
+
and requests for `advice` to `/advice` and `/advice/1` (instead of
137
+
`/advices/` and `/advices/1`).
133
138
134
139
When specifying irregular inflection rules for compound words, only the final word or phrase should be specified. For example, to specify the plural of `redCow` as `redKine` or `red-cow` as `red-kine`, only the final word segments `cow` and `kine` should be specified:
0 commit comments