PaulUithol/Backbone-relational — Issue #60: relation should be able to get content from model attribute different then 'key'
Author: 4vanger
Created: 2012-01-03 20:35:44+00:00
State: open

I'm having model like

```javascript
var SomeModel = Backbone.RelationalModel.extend({
relations: [
{
type: "HasOne",
key: "item",
relatedModel: 'ItemModel'
}
]
});
```
Then I init this model with following JSON:

```javascript
{
id: 128,
itemId: 356
}
```
So relation key is different from an attribute where ID is stored.
But I still want to keep relations - so when I change itemId - item will change. And vice versa - when I change item.id I'd like to update itemId attribute
What's the best way to get this behavior? I'm thinking on creating new Relation type that will have keyContentsAttribute option that will specify which model attribute to use. Is there better approach?