You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After thinking some more about it. Shouldn't it be possible to call has_one/has_many without a block and then just pass decorator, class, erc as an option?
In most casey where I habe an association I will already have a usable decorator for the collection class.
It should be possible to express recursive relationships using JSONAPI has_one/has_many.
Without has_one/has_many I could just use a self-referential collection:
However has_one/has_many requires a block, so I can't just specify
self
as the decorator.After looking at the source of
Roar::JSON::JSONAPI
I came up with thisbeautiful solutionhack:Surely there should be an easier solution, given that trees are not exactly uncommon.
I'm using roar master and representable 3.0.0.
The text was updated successfully, but these errors were encountered: