tim-vandecasteele/grape-swagger — pull request #135 by cdarne (2014-08-01 10:37:11+00:00)
Title: Fixed model inclusion in models with aliased references

If an entity has a field with alias and it references another entity, the former won't be included in the model's list.

Entity example:
```ruby
class AliasedThing < Grape::Entity
expose :something, as: :post, # the field is aliased
using: Something, # and it references another entity
documentation: { type: 'Something', desc: 'Reference to something.' }
end
```
The doc generated for an action using this entity will include the `AliasedThing` model but not the `Something` model.

That's because when the `models_with_included_presenters` method fails to match aliased fields. When it's looking in each models it tries to match fields from `model.exposure` and `model.documentation`. But `model.exposure` returns the primary name as key, and `model.documentation` returns the aliased name as key. That's why they don't match.

Here's my proposition for a fix. It's also a refactoring; I think it would be simpler to iterate just `model.exposure` and check for a `:documentation` key.