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

Ember.inflector() is deprecated; Update README (resolves issue #6) #5

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export default AirtableSerializer.extend();

## Models

Your model's attributes should be named with camel case (i.e. `thisFieldName`). If your table has a column named `Name` (with the first letter capitalized), the attribute in your model must *also* be capitalized (i.e. `Name` in both). **Keep the names consistent**.

If you want to skip persistance of certain attributes (ex. formula columns) add the `readOnly` option:

##### **`models/product.js`**:
Expand All @@ -89,6 +91,8 @@ You can use all of the [API features](https://airtable.com/api) when querying Ai

##### **`routes/products.js`**:

The table in your airtable base should be pluralized. For example, below we are querying for our `product` model -- so in AirTable, our table should be title `products`. (Unlike the fields, this is case insensitive.)

```JavaScript
import Ember from 'ember';

Expand Down
4 changes: 2 additions & 2 deletions addon/serializer.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Ember from 'ember';
import DS from 'ember-data';

const inflector = new Ember.Inflector();
import { pluralize } from 'ember-inflector';

export default DS.RESTSerializer.extend({

normalizeResponse(store, type, payload) {
const modelNamePlural = inflector.pluralize(type.modelName);
const modelNamePlural = pluralize(type.modelName);

if(payload.records) {
payload[modelNamePlural] = payload.records;
Expand Down