Skip to content
This repository
Browse code

Fix docs for Adapter's map API

  • Loading branch information...
commit 6d52a89c5696cb691836208e7a9d8eacf10ed61d 1 parent 1032a75
Jason Kriss authored March 14, 2013
2  packages/ember-data/lib/system/mixins/mappable.js
@@ -9,7 +9,7 @@ var classify = Ember.String.classify, get = Ember.get;
9 9
   For example, the DS.Adapter class can behave like a map, with
10 10
   more semantic API, via the `map` API:
11 11
 
12  
-    DS.Adapter.map('App.Person', { firstName: { keyName: 'FIRST' } });
  12
+    DS.Adapter.map('App.Person', { firstName: { key: 'FIRST' } });
13 13
 
14 14
   Class configuration via a map-like API has a few common requirements
15 15
   that differentiate it from the standard Ember.Map implementation.
19  packages/ember-data/lib/system/serializer.js
@@ -62,20 +62,29 @@ function mustImplement(name) {
62 62
   by implementing `keyForAttributeName`:
63 63
 
64 64
   ```javascript
65  
-    keyForAttributeName: function(type, name) {
66  
-      return name.underscore.toUpperCase();
67  
-    }
  65
+  keyForAttributeName: function(type, name) {
  66
+    return name.underscore.toUpperCase();
  67
+  }
68 68
   ```
69 69
 
70 70
   If your attribute names are not predictable, you can re-map them
71  
-  one-by-one using the `map` API:
  71
+  one-by-one using the adapter's `map` API:
72 72
 
73 73
   ```javascript
74  
-  App.Person.map('App.Person', {
  74
+  App.Adapter.map('App.Person', {
75 75
     firstName: { key: '*API_USER_FIRST_NAME*' }
76 76
   });
77 77
   ```
78 78
 
  79
+  This API will also work for relationships and primary keys. For
  80
+  example:
  81
+
  82
+  ```javascript
  83
+  App.Adapter.map('App.Person', {
  84
+    primaryKey: '_id'
  85
+  });
  86
+  ```
  87
+
79 88
   ## Serialization
80 89
 
81 90
   During the serialization process, a record or records are converted

0 notes on commit 6d52a89

Please sign in to comment.
Something went wrong with that request. Please try again.