mirego/encore — pull request #24 by simonprev (2014-06-02 18:31:55+00:00)
Title: Add auto-inclusion of linked and main resources for other resources

Huge proposition. Here the current problem:

- Let’s say we have a `Project` model and a `Map` model.
- And we call `/projects?include=maps`.

Here is the payload:

```json
{
"projects": [
{
"links": {
"maps": [
"8"
]
},
"id": "7",
"name": "The Red Rose of Scotland"
}
],
"linked": {
"maps": [
{
"links": {
"project": {
"href": "/projects/7",
"id": "7",
"type": "projects"
}
},
"id": "8",
"name": null,
"custom_map": false,
"position": null,
"tiles_directory": null
}
]
}
}
```

We can see in the `linked.maps[0].links.project` that the lib **can’t detect** that the project is already in the payload... :sadface:

So this pull request does one simple thing:

- It adds `included_models` in the `linked_collection` if it’s available in the model reflection.

What do you think?