From 205e00edfdde17b7cfefb15ed64785ddaf26597c Mon Sep 17 00:00:00 2001 From: Matt Marcum Date: Wed, 30 Mar 2016 11:39:36 -0700 Subject: [PATCH] added serializer blueprint and updated docs --- README.md | 12 ++++++++++++ .../files/__root__/serializers/__name__.js | 3 +++ blueprints/pouch-serializer/index.js | 3 +++ 3 files changed, 18 insertions(+) create mode 100644 blueprints/pouch-serializer/files/__root__/serializers/__name__.js create mode 100644 blueprints/pouch-serializer/index.js diff --git a/README.md b/README.md index 6c4ea88..9f6b618 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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. diff --git a/blueprints/pouch-serializer/files/__root__/serializers/__name__.js b/blueprints/pouch-serializer/files/__root__/serializers/__name__.js new file mode 100644 index 0000000..efbfd02 --- /dev/null +++ b/blueprints/pouch-serializer/files/__root__/serializers/__name__.js @@ -0,0 +1,3 @@ +import { Serializer } from 'ember-pouch'; + +export default Serializer.extend(); diff --git a/blueprints/pouch-serializer/index.js b/blueprints/pouch-serializer/index.js new file mode 100644 index 0000000..9b9fbf1 --- /dev/null +++ b/blueprints/pouch-serializer/index.js @@ -0,0 +1,3 @@ +var EmberCliSerializerBlueprint = require('ember-cli/blueprints/serializer'); + +module.exports = EmberCliSerializerBlueprint;