return @warnings if @warnings.present?
Invite#warnings reaches out to alot of associations so we need to ensure that we eagerload the associations upfront in case this serializer is ever used to display a list of invites.
Is it possible to move the fabrication here to
Just one minor concern regarding performance but otherwise the PR looks good
Your suggestion is not equivalent. No warnings (as in an empty
) is a valid value and should be returned. Given how confusing this can be, I’ll rewrite it a bit different.
This is a good suggestion and something I wanted to do, but slipped my mind. Unfortunately, eagerloading all associations can be difficult, so I’ll just add a
show_warnings option that will be used only when creating or editing an existing invite (and only the current invite is serialized).
be_blank is an even better change.
That sounds like a good idea.