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

Serializer blueprint #122

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ This provides
- `import PouchDB from 'pouchdb'`
- `import {Model, Adapter, Serializer} from 'ember-pouch'`

You must install an adapter and serializer in order for `Ember-Pouch` to work correctly. The [`blueprints`](#emberpouch-blueprints) are the easiest way to get started.

`Ember-Pouch` requires you to add a `rev: DS.attr('string')` field to all your models. This is for PouchDB/CouchDB to handle revisions:

```js
Expand Down Expand Up @@ -112,6 +114,16 @@ ENV.emberPouch.localDb = 'test';
ENV.emberPouch.remoteDB = 'http://localhost:5984/my_couch';
```

### Serializer

In order to create an application serializer run the following command from the command line:

```
ember g pouch-serializer application
```

An application serializer is required to get relations working correctly!

## Relationships

EmberPouch supports both `hasMany` and `belongsTo` relationships.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { Serializer } from 'ember-pouch';

export default Serializer.extend();
3 changes: 3 additions & 0 deletions blueprints/pouch-serializer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
var EmberCliSerializerBlueprint = require('ember-cli/blueprints/serializer');

module.exports = EmberCliSerializerBlueprint;