intridea/grape-entity — pull request #70 by mbleigh (2014-05-02 01:45:24+00:00)
Title: Detect entity representation on attribute values

This is something I've run into a number of times and (I think) this solves the issue. I'd like feedback in case there are dangers of which I'm not aware here. The problem is this:

```
class User < ActiveRecord::Base
include Grape::Entity::DSL

entity do
expose(:name){ "Bob" }
end
end

class Project < ActiveRecord::Base
include Grape::Entity::DSL
def user; User.new; end

entity do
expose :user
end
end
```

With the above code, what I would **expect** is the JSON representation to look like:

```json
{
"user": {
"name": "Bob"
}
}
```

Instead the native JSON representation for the object is coming through. This pull request alters the default behavior when no `:using` or `:proc` or block are specified on an exposure and tries to detect an entity for it, first by `value.entity` then by `value.class.entity_class.represent(value)`.

I believe this is making the behavior more what someone would expect. Any thoughts @dblock or others?