Open
Description
I have a couple entities that look like this:
class Foo::Entity < Grape::Entity
expose :id, :foo_name
end
class Bar::Entity < Grape::Entity
expose :id, :stuff, :things
expose :foo, :using => Foo::Entity
end
In the resource for Bar
, I'm doing
get '/' do
present @bars.index(:limit => @limit), :only => @only
end
For the first layer, this works great. For example, passing [:id, :things]
to @only
works perfectly. Passing nothing to @only
results in me getting the full Foo
object too, which is exactly what I want.
The issue arises when I pass [:id, :things, {:foo => [:foo_name]}]
. Instead of the expected id
, things
, and foo hash containing foo_name
, I get back id
, things
and a foo hash containing just the foo object's id
.