Imagine a service where a User
:has_many
Events
:through
an Interest
join model, and that there is an Interest#attending
flag to indicate whether the user plans on being at the event.
If I want to return a list of events, but also include the value of the #attending
flag for the current user, I could do this:
<interests>
<interest>
<attending>true</attending>
<event>
...
</event>
</interest>
</interests>
But I'd also to return the value of the #attending
flag for the authenticating when fetching just a single event. (To save a client having to make an extra HTTP request.) So, I'm tempted to return something more like this:
<events>
<event>
<attending>true</attending>
...
</event>
</events>
Is there any reason not to take this approach?