Skip to content

Commit

Permalink
Add documentation for option
Browse files Browse the repository at this point in the history
  • Loading branch information
singingwolfboy committed Dec 9, 2011
1 parent 0d4c8e5 commit 51b77c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ Value: a string (which can be resolved to an object type on the global scope), o

Determine the type of collections used for a `HasMany` relation. Defining a `url(models<Backbone.Model[]>)` function on this Collection that's able to build a url for either the whole collection, or a set of models enables `fetchRelated` to fetch all missing models in one request, instead of firing a separate request for each. See [Backbone-tastypie](https://github.com/PaulUithol/backbone-tastypie/blob/master/backbone-tastypie.js#L74) for an example.

### collectionKey

Value: a string or a boolean

By default, the relation's `key` attribute will be used to create a reference to the RelationalModel instance from the generated collection. If you set `collectionKey` to a string, it will use that string as the reference to the RelationalModel, rather than the relation's `key` attribute. Be careful: if you use a value for `key` or `collectionKey` that is the name of an already-existing property on the RelationalModel, that property will be overwritten by the reference to the RelationalModel instance.

If you don't want this behavior at all, just set `collectionKey` to false (or any falsy value) and this reference will not be created.

### includeInJSON

Value: a boolean, or a string referencing one of the model's attributes. Default: `true`.
Expand Down

0 comments on commit 51b77c0

Please sign in to comment.